[Libav-user] GIF API access

Malik Jahanzeb malikjahanzeb7 at gmail.com
Tue Feb 14 22:09:33 EET 2017

I guess gif.c functionality is exposed as a 'muxer' with the following
standard interface that all muxers have in ffmpeg:

static const AVClass gif_muxer_class = {
    .class_name = "GIF muxer",
    .item_name  = av_default_item_name,
    .version    = LIBAVUTIL_VERSION_INT,
    .option     = options,

AVOutputFormat ff_gif_muxer = {
    .name           = "gif",
    .long_name      = NULL_IF_CONFIG_SMALL("GIF Animation"),
    .mime_type      = "image/gif",
    .extensions     = "gif",
    .priv_data_size = sizeof(GIFContext),
    .audio_codec    = AV_CODEC_ID_NONE,
    .video_codec    = AV_CODEC_ID_GIF,
    .write_header   = gif_write_header,
    .write_packet   = gif_write_packet,
    .write_trailer  = gif_write_trailer,
    .priv_class     = &gif_muxer_class,
    .flags          = AVFMT_VARIABLE_FPS,

You need to find out how to use a muxer in your program. Challenge is that
ffmpeg samples are few, very high level and work at a file level. I wished
there was a sample program to just demonstrate how to use a muxer or
demuxer etc.

I needed a different muxer for my program but I couldn't find an example to
follow. I ended up surgically adding code snippets into my program.


On Tue, Feb 14, 2017 at 1:08 PM, Gustav González <xtingray at gmail.com> wrote:

> Hi,
> I wonder if using Libav as dependency allows me to call the functions
> defined in the file libavformat/gif.c
> Functions like these:
> static int gif_image_write_header(AVIOContext *pb, int width, int height,
>                                   int loop_count, uint32_t *palette)
> static int gif_write_packet(AVFormatContext *s, AVPacket *pkt)
> static int gif_write_trailer(AVFormatContext *s)
> As the avconv binary allows me to create animated GIF examples from
> sequences of PNG files, I guess it is accessing the GIF API, but I was
> unable to trace all the route to find the top level functions I could use
> to create animated GIFs from my own code.
> Any sugestion? Any handy example to watch? I am still studying avconv.c
> but it's a little complex to follow.
> Thanks.
> --
> ============================
>   Gustav Gonzalez
>   xtingray at gmail.com
> ============================
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170214/b29c1d3a/attachment.html>

More information about the Libav-user mailing list