Extracting frames from MP4/FLV?

blez picture blez · Nov 27, 2011 · Viewed 46k times · Source

I know it's possible with FFMPEG, but what to do if I have a partial file (like without the beginning and the end). Is is possible to extract some frames from it?

Answer

ConstNT picture ConstNT · Dec 15, 2011

The command

ffmpeg -ss 00:00:25 -t 00:00:00.04 -i YOURMOVIE.MP4 -r 25.0 YOURIMAGE%4d.jpg

will extract frames

  • beginning at second 25 [-ss 00:00:25]
  • stopping after 0.04 second [-t 00:00:00.04]
  • reading from input file YOURMOVIE.MP4
  • using only 25.0 frames per second, i. e. one frame every 1/25 seconds [-r 25.0]
  • as JPEG images with the names YOURIMAGE%04d.jpg, where %4d is a 4-digit autoincrement number with leading zeros

Check you movie for the framerate before applying option [-r], same applicable for [-t], unless you want to extract the frames with the custom rate.

Never tried this with the cropped (corrupted?) input file though. Worth to try.