Sunday, November 20, 2016

How to extract frames in a video using ffmpeg?

You can follow the steps given below to extract all frames of a video using ffmpeg tool. 

  • Download ffmpeg package for your OS
     https://www.ffmpeg.org/download.html#build-mac

  • Unzip the folder and move to that particular folder 
      cd /Lion_Mountain_Lion_Mavericks_Yosemite_El-Captain_04.11.2016

  • Extract frames using the following command:

./ffmpeg -i [your input video file] -r [frame rate] [output file format]

E.g.,

For a video names test.mp4 with frame rate of 8fps,

./ffmpeg -i test.mp4 -r 8/1 output%03d.jpeg

All the frames will be saved to the same directory which the command is executed. 

No comments:

Post a Comment