Extract image from specific video frame with ffmpeg

Extract 1st frame as image from video

ffmpeg -y -i /data/Short2.mp4 -vframes 1 /tmp/Short2.jpg

The parameter meanings:

  • param -i
    defines the file incl. path to the input video, in our example the file /data/Short2.mp4
  • param -vframes 1
    only handle one video frame, in the above case exactly the frame 1 of the video
  • param /tmp/Short2.jpg
    defines the output filename of the fetched image

Extract 2nd frame as image from video

ffmpeg -y -i Short2.mp4 -vf "select=eq(n\,2)" -vframes 1 /tmp/Short2.jpg

The parameter additional to the previous example:

  • -vf “select=eq(n\,2)”
    means: get the frame which equals to the number 2. In our case exactly the frame 2

Extract 100th frame as image from video

ffmpeg -y -i Short2.mp4 -vf "select=eq(n\,100)" -vframes 1 /tmp/Short2.jpg
  • -vf “select=eq(n\,100)”
    get the 100th frame

Extract a frame as image at a specific time

ffmpeg -y -i Short2.mp4 -ss 01:12:30 -vframes 1 /tmp/Short2.jpg
  • -ss 01:12:30
    get the frame at the time position 1h 12min and 30sec