I have a video and I want to extract 35-th frame out of this video.
I want it to be a png image if possible.
I know there are a lot of questions like this, but I could not find a solution that was using frame number.
I have a video and I want to extract 35-th frame out of this video.
I want it to be a png image if possible.
I know there are a lot of questions like this, but I could not find a solution that was using frame number.
Use the select filter:
ffmpeg -i <input> -vf "select=eq(n\,34)" -vframes 1 out.png
counting starts at 0, so 35th = n value of 34.
It should be noted that the select filter will decode the video up to the selected frame, so this can be quite slow if you are trying to fetch a frame one hour into a video.
Two quick-and-dirty ways:
Use the FFmpeg executable with the seek option. You'll need to convert to a time first, e.g. if I want frame 150 and my video is 29.97 FPS the command will be ffmpeg -ss 00:00:05.01 -i myvideo.avi -frames:v 1 myimage.jpg. This might be slightly inaccurate. To seek by exact frame you'd need to use the FFmpeg library with C++.
Another 'hacky' way is using VLC media player. Check menu View -> Advanced controls. Pause video and click the Frame-by-frame button 34 times.