0

I am using Powerpoint to create animations which I then export into a video and crop and convert to GIF using ffmpeg.

Here is the (cropped) MP4 video, and this is the GIF I was able to produce:

enter image description here

To my (untrained) eye, it appears rather grainy, and not terribly smooth. I am wondering if there are options in ffmpeg I can be using thaat will give me a better quality GIF.

Here is the command I am using to crop:

ffmpeg -i in\vlans-3vlans-tag-untag.mp4 -filter:v "crop=1262:423:91:154" in\cropped_vlans-3vlans-tag-untag.mp4

Here are the two commands I am using to convert:

ffmpeg -y -vf fps=35,scale=896:-1:flags=lanczos,palettegen out\PALETTE.png -i in\cropped_vlans-3vlans-tag-untag.mp4
ffmpeg -y -filter_complex "fps=35,scale=896:-1:flags=lanczos[x];[x][1:v]paletteuse" -i in\cropped_vlans-3vlans-tag-untag.mp4 -i out\PALETTE.png  out\vlans-3vlans-tag-untag.gif

I should say, I am not particularly talented with ffmpeg, I mostly put these commands together from googling and other posts on this site. So if any of the arguments I am using are making the conversion worse, I'd also be interested in hearing about it.

I tried the -b 2048k option, and I couldn't tell a difference in quality. In fact, when I ran a SHA256 hash on the output file with and without this option, the result was identical.

  • 1
    I find that ffmpeg does a fairly poor job with gifs. Have a look at gifsicle, I use it to compile my gifs and imagemagick to create the source gifs from pngs I export using ffmpeg. I find it produces higher quality, smaller results, at the expense of a bit more faffing around. lcdf.org/gifsicle and imagemagick.org – stib Jun 27 '16 at 6:05
1

The separate cropping step is leading to a generational loss. You can combine that and see.

ffmpeg -i in\vlans-3vlans-tag-untag.mp4
       -vf "crop=1262:423:91:154,scale=896:-1:flags=lanczos,fps=35,palettegen"
       out\PALETTE.png

ffmpeg -i in\vlans-3vlans-tag-untag.mp4 -i out\PALETTE.png
       -filter_complex "[0]crop=1262:423:91:154,scale=896:-1:flags=lanczos,fps=35[v];
                        [v][1]paletteuse"
       out\vlans-3vlans-tag-untag.gif
  • Hrmm, I'm having a hard time seeing a difference. Here is the image the original way I did it, and here it is using the combined crop/convert step. The 2nd file is slightly smaller, I did notice. So at least that is an improvement. – Eddie Jun 27 '16 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.