Creating an Animated GIF using FFmpeg

FFmpeg Notes: https://www.rickmakes.com/ffmpeg-notes/

FFmpeg playlist: https://www.youtube.com/playlist?list=PLErU2HjQZ_ZOPDZ71Khzt5PX4X4j6flkg

Play Video Starting at 1 minute 2 seconds for 30 seconds
ffplay -ss 00:01:02 -t 00:00:30 train_original.mp4
Scale Video (smaller) and Lower Framerate
ffmpeg -i train_original.mp4 -ss 00:01:02 -t 00:00:30 -vf "fps=10,scale=320:-1" -an train_sm.mp4
Create 256 Color Palette from Video
ffmpeg -i train_sm.mp4 -vf palettegen palette.png
Create Animated GIF using Scaled Video and Color Palette
ffmpeg -i train_sm.mp4 -i palette.png -filter_complex "fps=10,scale=320:-1[x];[x][1:v]paletteuse" train.gif
Create Timer Video
ffmpeg -f lavfi -i color=white@0.0:s=240x96,format=rgba -ss 00:00:00 -t 00:01:00 -vf "drawtext=fontfile=/System/Library/Fonts/Monaco.dfont:text='%{pts\:gmtime\:0\:%M\\\:%S}':fontcolor=white:fontsize=64:x=(w-tw)/2:y=(h-th)/2" -vcodec prores_ks timer_prores.mov

https://www.rickmakes.com/creating-an-elapsed-timer-using-ffmpeg/

Reverse Timer Video (for countdown timer)
ffmpeg -i timer_prores.mov -vf reverse timer_reverse.mov
Create 256 Palette
ffmpeg -i timer_prores.mov -vf palettegen palette.png
Create Animated GIF Timer
ffmpeg -i timer_prores.mov -i palette.png -filter_complex "fps=10,scale=240:-1[x];[x][1:v]paletteuse" timer.gif

Leave a comment

Your email address will not be published. Required fields are marked *