Make a Poster JPG for each MP4

Nifty command to take a list of MP4 videos and make a poster JPG for each one:

for i in `ls *.mp4`; do echo $i; j=`echo $i | sed -e 's/.mp4/.jpg/'`; echo $j; ffmpeg -i $i -r 1 -f image2 -t 1 $j; done

This takes each mp4 video in a directory and creates a .jpg for it. In the ffmpeg command, the -r 1 means 1 frame per second, and the -t 1 means stop after 1 second. The -f image2 means the output is an image.

This is useful when you have a bunch of videos to upload to say WordPress for use with, oh say, vipers-video-quicktags plugin that automatically looks for a file with the same name, but a .jpg extension, for the poster. In case it’s not obvious, the poster is the image that displays on a video before play.

Comments are closed.