MP4 vs GIF


Spec MP4 GIF
File Size 409kB 413kB
Resolution 320x240 320x240
FPS 5 0.8
Quality medium (crf=28) low (256 colors)
Audio yes no
Support HTML5 browser with the good video decoder [1] any browser from the XX century.

[1]: That should include Internet Explorer, Edge, Firefox, Chrome[2]

[2]: Yes Chrome too, since that for WebRTC, the 2 MTI[3] video codecs, for desktop browsers[4] are Vp8 and H.264

[3]: Mandatory-To-Implement

[4]: mobile WebRTC engine can choose to implement only one of the video codec.


ffmpeg -i input.avi -vf scale=320:-1 -r 0.8 -f image2pipe -vcodec ppm - | convert -delay 80 -loop 0 - gif:- | convert -layers Optimize - output.gif (from StackExchange)

The output fps and delay values have to follow the rule to keep a realistic speed playback.



ffmpeg -i input.avi -vf scale=320:-1 -r 5 -c:v libx264 -preset slow -crf 28 -c:a copy -y output.mp4