[Libav-user] GIF API access
Gustav González
xtingray at gmail.com
Mon Feb 27 05:13:56 EET 2017
Hi!
I'm getting closer to create an animated GIF using a (Qt) QImage array as
input.
This is the latest GIF file I could create ->
http://maefloresta.com/tmp/test.gif
Using this method as part of the process, I insert every frame into the GIF
file:
writeVideoFrame(AVFormatContext *oc, AVStream *video_st, const QImage &image)
{
QImage img = image.convertToFormat(Format_RGB888);
AVPacket pkt;
av_init_packet(&pkt);
pkt.flags |= AV_PKT_FLAG_KEY;
pkt.stream_index = video_st->index;
pkt.data = (uint8_t *) img.bits();
pkt.size = sizeof(AVFrame);
av_write_frame(oc, &pkt);
frameCount++;
}
As you can see it, the GIF file is not animated. Just the first frame is
displayed, but the picture encoding is accurate. I was sneaking around
inside the container using an hex editor and the 15 frames I created for
that example are there. I am missing some kind of flag or instruction to
activate the animated format.
Any suggestion?
PS: I tried to use the function *avcodec_encode_video2()* to add the frames
into the file, but it was unsuccessful. Creating my own packets (AVPacket)
was the best approach for now.
2017-02-14 18:58 GMT-05:00 Carl Eugen Hoyos <ceffmpeg at gmail.com>:
> 2017-02-14 21:09 GMT+01:00 Malik Jahanzeb <malikjahanzeb7 at gmail.com>:
>
> > I needed a different muxer for my program but I couldn't find an example
> to
> > follow.
>
> Did you look into doc/examples?
>
> Carl Eugen
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
--
============================
Gustav Gonzalez
xtingray at gmail.com
============================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170226/64ed3f79/attachment.html>
More information about the Libav-user
mailing list