[Libav-user] Converting ffmpeg cli command to libav c code

martymoose21 at gmail.com martymoose21 at gmail.com
Fri Dec 6 22:54:54 EET 2024


To Whom it may concern,

 

I'm trying to implement this cli command into c that calls the libav API,
however I am stuck as this is my first
time using the libav libraries. I can't get it to write the 'covr' tag like
the cli command does and I don't 
really know where I'm going wrong. It seems to write the jpeg data but not
in a compliant format and therefore,

only VLC can recognize the attached_pic. 

>From what I understand here is what roughly needs to happen: 

1.	open the jpeg file using avformat_open_input
2.	call avformat_find_stream_info with AVFormatContext param from step
1
3.	create a new stream on the output AVFormatContext using
avformat_new_stream
4.	call avcodec_parameters_copy with the jpeg context as the source and
the output as the destination
5.	OR the created output stream's 'disposition' member with
AV_DISPOSITION_ATTACHED_PIC (from what I understand the library fills
'attached_pic' automatically?)
6.	call avformat_write_header with the output AVFormatContext

 

 

As I said previously, it's my first time using the lib and I am unsure if I
missed a step or made an error executing the steps such as being out of
order and/or misinterpreting what needed to occur.

 

Any help is greatly appreciated.

 

ffmpeg -i file_audio.m4a -i file.jpg -map 0 -map 1 -c copy -disposition:v:0
attached_pic file_audio_with_pic.m4a

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20241206/7c3d06b1/attachment.htm>


More information about the Libav-user mailing list