[Libav-user] GIF API access

Gustav González xtingray at gmail.com
Mon Mar 6 02:44:42 EET 2017

2017-03-05 8:43 GMT-05:00 Carl Eugen Hoyos <ceffmpeg at gmail.com>:

> 2017-03-05 2:52 GMT+01:00 Gustav González <xtingray at gmail.com>:
> > QImage img = image.convertToFormat(Format_RGB888);
> Not necessarily related: Why are you not using libswscale or
> the scale filter?

In fact, I tried it using different parameters for a week. That was my
first approach to the problem, but always I got an error message from the
encoder, telling me that the AVFrame format was wrong.
Looking for a solution, I found this alternative that only requires two
lines to get an accurate AVFrame. All I can say about it, is that it's

> > avpicture_fill((AVPicture *)frame, img.bits(), AV_PIX_FMT_RGB24, w, h);
> FFmpeg's git encoder does not support RGB24, so whatever you are
> doing is unfortunately not supported here.

Someone told me the same. So I started to use the format AV_FIX_FMT_RGB8.
The funny thing was that while I was running my program, I got a (red)
warning message from the libav API, asking me to use RGB24. I already
checked the gif.c code, and effectively there is NOT support for RGB24. I
can't explain it.

Counting on I have been researching about this topic for around a month,
testing all the logic suggestions and the crazy ones, I decided to change
the format to RGB24, following the libav warning advice. Crazy or not, the
warning message disappeared and the code works, I mean, I got an animated
GIF from a sequence of QImage objects.

About the pending issue, I thought it was related to the FPS variable of
the files but I was wrong, the problem is the size of them, they are
giants! (MBs for every second) So large, that the browser only can play
them slowly. I ran other tests using mplayer and the speed of the
animations is right.

So, my next challenge is to low the size of the frames to finish my
implementation. Any hint?

  Gustav Gonzalez
  xtingray at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170305/0476b8e6/attachment.html>

More information about the Libav-user mailing list