Jump to content

Recommended Posts

Posted

This looks like it might be useful from time-to-time:

 

...Run FFmpeg and make sure the video file you want to extract the frame from is in the correct directory before you proceed. Use the following command where ‘My-File.avi’ should be replaced by the name of the file you want to extract the frame from.

 

Similarly, the ’30’ should be replaced with the time in number of seconds that the frame appears at. Replace ‘My-Frame.png’ with the file name you want the frame to be saved with. Do not remove the file extension...

 

ffmpeg -i  My-File.avi  -vf select=eq(n\,30) -vframes 1 My-Frame.png

 

Link: Extract A Video Frame In PNG Format Using FFmpeg In Windows

Posted

If you have a lot of videos you want to extract frames from you can run the following command (in a batch file):

 

@echo off
for %%a in (*.mp4) do ffmpeg -i "%%a" -vf select=eq(n\,30) -vframes 1 "%%~na.png"

 

The image(s) will be named based on the filename of the input video.

 

There's also a faster method of extracting frames from videos with ffmpeg:

 

for %%a in (*.mp4) do ffmpeg -ss [color="#FF0000"]30[/color] -y -i "%%a" -vframes 1 "%%~na.png"

 

The offset parameter (-ss) is the number of seconds the frame appears at and needs to be set before the input parameter (-i). This will cause ffmpeg to seek to that position in the video stream *without* decoding it and skip anything other than keyframes which improves performance significantly.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...