Extract a thumbnail from a specific video frame

26,673

Solution 1

To get to some specific frame you should use filter select. Command to extract frame 100 out of video should look like this:

 ffmpeg -i in_video.avi -vf "select=gte(n\,100)" -vframes 1 out_img.png

Solution 2

Use the following method

ffmpeg -ss 00:10:20 -t 1 -s 400x300 -i <INPUT_FILE> -f mjpeg <OUTPUT_FILE>

-ss and the time argument that follows tells ffmpeg at what point you want the screenshot snapped. In this example, ffmpeg will take a shot at the 10 minute and 20 second point. -t tells ffmpeg that you want only 1 shot, -s is the size of the pic, and -f tells it to make a photo (but not limited to jpg). For example, to generate a png screenshot for Batman.avi at the 1 hour, 12 minute, and 30 second point:

ffmpeg -ss 01:12:30 -t 1 -s 400x300 -i Batman.avi -f mjpeg Batman.png

Solution 3

or just

-vf "select=eq(n\,100)" 100.png

the -vframes option could be omitted

Share:
26,673
user2066408
Author by

user2066408

Updated on July 27, 2022

Comments

  • user2066408
    user2066408 almost 2 years

    Given a specific frame I need to extract an image (a thumbnail) from a video using ffmpeg.

    E.g. I can do:

    ffmpeg -i test.mp4 -ss 00:01:14.35 -vframes 1 out2.png
    

    I can extract an image from a specific time (00:01:14.35), but what I need is to extract an image from a specific frame.