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

Ben Harper rogojin at gmail.com
Sun Dec 8 13:05:42 EET 2024


A possibly useless remark, but have you tried asking your favourite AI
model to generate this code for you?

On Fri, Dec 6, 2024 at 10:55 PM <martymoose21 at gmail.com> wrote:

> 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
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20241208/26040914/attachment.htm>


More information about the Libav-user mailing list