Making a GIF using FFMPEG
First, open terminal install FFMPEG
brew install ffmpeg
Now cd over to the directory your videos are and run ffmpeg on the video you want to convert to a GIF. Something like this:
ffmpeg -ss 20.0 -t 3.0 -i 0303201545.mp4 -s 480x320 -f gif vid1.gif
This will seek (-ss) 20 seconds, then grab 3 seconds (-t) of the video, output (-s) as a 480×320 gif
Animation of the process:
And the command to convert the screen cast from MOV to GIF and speed up the GIF:
ffmpeg -ss 0.0 -t 17.0 -i Screen\ Recording\ 2020-03-03\ at\ 4.54.25\ PM.mov -filter:v "setpts=0.1*PTS,scale=720:-1" -f gif howtoffmpeg.gif
setpts=0.1 speeds up the video
scale=720:-1 changes the scale of the video to 720 wide and keeps the aspect ratio of the video.
That’s it. The GIFs make uploading to the Crashspace WordPress blog easier.
3 thoughts on “Making a GIF using FFMPEG”
Kevin , how i can do it with big video ? gif should be comprised of 10 ( or max available ) different screenshots across the videos length. So for example if a video is 30 minutes long a screenshot should be taken every 3 minutes and all the 10 screenshots should be turned into a gif.
Hi , Kevin.
How i can do gif should be comprised of 10 different screenshots across the videos length. So for example if a video is 30 minutes long a screenshot should be taken every 3 minutes and all the 10 screenshots should be turned into a gif ?
This StackOverflow thread seems to answer your question:
First you get thumbnails from the video:
ffmpeg -i input.mp4 -vf thumbnail=300,setpts=N/TB -r 1 -vframes 10 inputframes%03d.png
Then convert those thumbnails to a video.