FFMPEG How to extract frames of a video at a certain time frame?

0

I am working on laying out video stills in a book. I am pretty new to using the command line and discovered ffmpeg just yesterday.

Right now, I want to extract 8fps from a video between, for example, 00:05:30 and 00:42:30. This is what I have written. I am not sure how to include the out point or if I am using the right option to begin with (-ss).

ffmpeg -ss 00:05:30 -i video.mp4 -vf fps=8 out%05d.png

As another approach, I know this segment is 37 seconds. So:

ffmpeg -ss 00:05:30 -i video.mp4 -t 00:00:37 -vf fps=8/16 out%05d.png

I am also wondering if -ss has to be specified before the input or if it can be placed after. I guess I'm confused about syntax. Could it be ffmpeg -i video.mp4 -ss 00:05:30 ... as well? It seems to be running, but slower.

AFG

Posted 2018-12-30T17:10:57.413

Reputation: 11

Question was closed 2018-12-30T21:11:16.950

1ffmpeg -ss 00:05:30 -to 00:42:30 -i video.mp4 -vf fps=8 out%05d.png – Gyan – 2018-12-30T18:16:20.527

Please read: https://trac.ffmpeg.org/wiki/Seeking

– slhck – 2018-12-30T21:11:46.520

@slhck You marked this as duplicate, but it is not quite the same. That is only cutting the video but I am asking how to take screenshots from a segment of the video? Is the solution to just add -vf fps=8 out%05d.png after ffmpeg -ss [start] -i in.mp4 -t [duration]? – AFG – 2018-12-30T23:10:25.983

Yes, isn't that what your original command does, except for the missing "to" option? (Or duration using the "t" option, both are valid.) I thought you were unclear about the seeking behavior, hence the link to the other question. – slhck – 2018-12-30T23:24:20.797

Yes I was just not sure if adding -vf ... was all that it took. Thank you a lot for sending both links about the seeking behavior. It definitely cleared up a lot. – AFG – 2018-12-30T23:28:41.537

@Gyan Option to (record or transcode stop time) cannot be applied to input url video.mp4 -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to. – Michael – 2019-12-18T21:53:12.720

You're using an old version. – Gyan – 2019-12-19T04:24:32.640

No answers