I want to make animation using number of images. for this I want to extract images from video. I tried vlc, but it was hanging and didn't get good result.
Thus want to use ffmpeg.
First you need to install ffmpeg. It is a command line tool.
- Go to the ffmpeg download site and download the zip file that best fits you computer's specs. Choose "static" linking and the "nightly git" version for the most current usability.
- Create a folder on your computer to uppack the zip file. This folder will be your "installation" folder. I chose C:\Program Files\ffmpeg. This is a good idea because you will treat this like a regular program. Unpack the zip file into this folder.
- The folder should now contain a number of other folders, including one titled bin where ffmpeg.exe is saved. We're not done yet. Double clicking that file does nothing. Remember, this is a command line program. It runs in cmd.
- Before you can use ffmpeg.exe in cmd you have to tell your computer where it can find it. You need to add a new system path. First, right click This PC (Windows 10) or Computer (Windows 7) then click Properties > Advanced System Settings > Advanced tab > Environment Variables.
- In the Environment Variables window, click the "Path" row under the "Variable" column, then click Edit
- The "Edit environment variable" window looks different for Windows 10 and 7. In Windows 10 click New then paste the path to the folder that you created earlier where ffmpeg.exe is saved. For this example, that is C:\Program Files\ffmpeg\bin\
Now use following code to export all frames. (Note: it may produce thousands of images)
ffmpeg -i anim.mp4 f%04d.webp
For extracting only keyframes use
ffmpeg -i video.webm -vf "select=eq(pict_type\,I)" -vsync vfr thumb%04d.jpg
Extract frames in a regular time basis
ffmpeg -i video.webm -vf fps=1 thumb%04d.jpg