2

I am using this argument to FFmpeg to get a thumbnail image from a video file:

ffmpeg -i input.mp4 -vframes 1 -s 320x240 -ss 10 output.jpg

I understand that -ss 10 tells FFmpeg to capture the thumbnail image at the 10th second, but what is the purpose of -vframes 1?

0

2 Answers 2

1

That will tell ffmpeg to output one frame. Otherwise it will attempt to use the image file muxer to output multiple images. From the help:

$ ffmpeg -h
...
-vframes number     set the number of video frames to record
1
  • Its purpose becomes more clear when capturing multiple thumbnail images, but when capturing a single image (by not specifying %d in the output filename) it's hard to see what it's for!
    – johnny92
    Oct 28, 2014 at 23:09
0

For posterity, if you then want to add the thumbnail as a file icon, and delete the intermediate jpeg, add this to an automator "quick action", passing the input as an argument:

export PATH=/usr/local/bin:/opt/homebrew/bin:$PATH

for f in "$@"
do 
   ffmpeg -y -ss 60 -i "$f" -v error -vf select="eq(pict_type\,I),scale=-1:640,crop=in_w:in_h:0:0" -qscale:v 3 -vframes 1 "$f".jpg
   fileicon set "$f" "$f".jpg
   rm "$f".jpg
done

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .