[Solved] How to use palettegen and paletteuse filters with FFmpeg in C++?

I want to create an animated gif in a QT project.
When I scale the a QImage to AV_PIX_FMT_RGB8 directly the output looks awfull with flickering artifacts and when I scale to AV_PIX_FMT_YUV420P in between the output is dithered witch does not look much better.

I found out that ffmpeg is able to produce a palette file using a filter called palettegen and then convert a movie to gif using this palette.

Is there any sample c++ file out which I could use for my project or does anybody have a clue who to use these filters in code?

Read more here: Source link