[Libav-user] GIF API access
Carl Eugen Hoyos
ceffmpeg at gmail.com
Mon Mar 6 10:58:03 EET 2017
2017-03-06 5:56 GMT+01:00 Gustav González <xtingray at gmail.com>:
> 2017-03-05 20:46 GMT-05:00 Carl Eugen Hoyos <ceffmpeg at gmail.com>:
>>
>> 2017-03-06 1:44 GMT+01:00 Gustav González <xtingray at gmail.com>:
>>
>> > So, my next challenge is to low the size of the frames to finish my
>> > implementation. Any hint?
>>
>> Yes, please see my last two emails in this thread.
To repeat and evaluate:
Current FFmpeg does not support RGB24 in gif.
I don't know if you are using other software or an
old version of FFmpeg, in both cases, you cannot
get support here.
This is the first issue you have to solve: Either update
to current FFmpeg or get support somewhere else.
And yes, you have guessed correctly that PAL8
ensures a smaller file size.
> Getting back to the libswscale approach, I was trying to transform the
> QImage sequence into AVFrame variables:
>
> QImage image(path_to_image);
> AVPicture picture;
> avpicture_alloc(&picture, PIX_FMT_RGB32, w, h);
> memcpy(picture.data[0], image.bits(), w*h*4);
Unrelated: I suggest you try to avoid the memcpy().
>
> QVector<int> strides(image.height(), image.bytesPerLine());
> struct SwsContext *sws_context = sws_getContext(w, h, PIX_FMT_RGB32,
> w, h, AV_PIX_FMT_RGB8, SWS_BICUBIC, NULL, NULL, NULL);
It is not so easy to get palettised data. It is a two-step process
involving the paletteget and paletteuse filter, see for example:
http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
Please try with ffmpeg (the application) first to find out if
this is really worth the effort (and if you need to program
something instead of calling the application).
Carl Eugen
More information about the Libav-user
mailing list