ffmpeg snippets
extract the first frame for every mp4 video (change extension to work with others) e.g. for a timelapse
https://gist.github.com/nkint/8563954
i=1
for avi in *.mp4; do
name=`echo $avi | cut -f1 -d'.'`
jpg_ext='.jpg'
echo "$i": extracting the first frame of the video "$avi" into "$name$jpg_ext"
ffmpeg -loglevel panic -i $avi -vframes 1 -f image2 "$i_$name$jpg_ext"
i=$((i+1))
done
combine frames in the folder into a gif
ffmpeg -i %d_*.jpg output.gif
make a shell script
put it in a script, e.g. run.sh:
i=1
for avi in *.mp4; do
name=`echo $avi | cut -f1 -d'.'`
jpg_ext='.jpg'
echo "$i": extracting the first frame of the video "$avi" into "$name$jpg_ext"
ffmpeg -loglevel panic -i $avi -vframes 1 -f image2 "$i_$name$jpg_ext"
i=$((i+1))
done
ffmpeg -i %d_*.jpg output.gif # or output.mp4
and you have your timelapse!