<p>I would say that you might be overthinking it a little. You could speed up the video mathematically (in an editor) and then extract all of the frames from that. For example in Blender we could, if it is 24fps, speed it up by 1440 times (to get 1 frame every minute) and then export all of the frames from the video as PNG or another format to a folder. I use this for time-lapses sometimes, and this way there is no scripting involved. I would still put the 23.98 into the equation to make sure you are getting the exact frames and not skipping over a couple.</p>
<p>Just multiply your fps by your increments in sec.</p>
<p>(fps*sec)</p>
<p>Hope this helps!</p>

CC BY-SA 4.0
2024-03-08T17:37:03.267Z
2024-03-08T17:37:03.267Z
Logan Colón
<p>Motivation: I would like to seek the frame, then take high quality and exact time screenshots (images) from a video.</p>

<p>The video is length is 00:48:43.71 and 23.98 fps (we can think it is 24 fps, isn't it?).</p>

<hr>

<p>With reference from this webpage: <a href="https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video" rel="noreferrer">Create a thumbnail image every X seconds of the video</a></p>

<p>I wrote some commands that grab a frame every hour, every minute, and every second.</p>

<p>After exterminating the images, the screenshots are in fact taken from the <strong>half</strong> hour, <strong>half</strong> minute, and <strong>half</strong> second. You will understand shortly.</p>

<p>For example, the command to grab a frame every minute, it is in fact extracting the frame <strong>at the half minute</strong>, which means the 00:00:30 , 00:01:30 , 00:02:30 , and so on. That is why I name to filename as follow:</p>

<pre><code>ffmpeg -i "video.mp4" -start_number 0 -vf fps=1/60 "B 00-%02d-30.000.png"
</code></pre>

<p>(adding the "B" prefix is to prevent overwriting by different commands.)</p>

<p>For example, to grab a frame every second from 00:03:00 to 00:04:00, the commend is:</p>

<pre><code>ffmpeg -i "video.mp4" -start_number 0 -vf fps=1 -ss 00:03:00 -to 00:04:00 "C 00-03-%02d.500.png"
</code></pre>

<p>To verify them, we can extract all the frames from 00:03:29 to 00:03:31 :</p>

<pre><code>ffmpeg -copyts -ss 00:03:29 -i "video.mp4" -start_number 0 -to 00:03:31 "D 00-03-29.%03d.png"
</code></pre>

<p>We may check the following image files are identical:</p>

<p><code>D 00:03:29.012.png</code> is identical to <code>C 00:03:29.500.png</code>.</p>

<p><code>D 00:03:29.024.png</code> is identical to <code>B 00:03:30.000.png</code>.</p>

<p><code>D 00:03:29.036.png</code> is identical to <code>C 00:03:30.500.png</code>.</p>

<hr>

<p>Those are my findings from trials and errors this morning. Here comes my question:</p>

<p>Let's take "extract a frame at exactly every minute" as an example, how can we get / what is the command to get the frames 00:00:00.000 , 00:00:01.000, 00:00:02.000 , and so on?</p>

<p>I have just heard of <code>ffmpeg</code> this morning. I still do not know what <code>-copyts</code> means (after reading the <a href="https://ffmpeg.org/ffmpeg.html" rel="noreferrer">docs</a>) and when I need to put <code>-ss position</code> before <code>-i</code> and when to put it at the output part. So please <strong>do correct me</strong> if I am using the wrong commands.</p>

<ffmpeg><framerate><timecode><video-capture><output>
Extract the frame (in image format) at exactly every minute (or second) from a video (by ffmpeg)
midnite
# Extract the frame (in image format) at exactly every minute (or second) from a video (by ffmpeg)

(Asked by: username_0 on 2015-07-08)

Motivation: I would like to seek the frame, then take high quality and exact time screenshots (images) from a video.
The video is length is 00:48:43.71 and 23.98 fps (we can think it is 24 fps, isn't it?).

With reference from this webpage: Create a thumbnail image every X seconds of the video
I wrote some commands that grab a frame every hour, every minute, and every second.
After exterminating the images, the screenshots are in fact taken from the half hour, half minute, and half second. You will understand shortly.
For example, the command to grab a frame every minute, it is in fact extracting the frame at the half minute, which means the 00:00:30 , 00:01:30 , 00:02:30 , and so on. That is why I name to filename as follow:
ffmpeg -i "video.mp4" -start_number 0 -vf fps=1/60 "B 00-%02d-30.000.png"

(adding the "B" prefix is to prevent overwriting by different commands.)
For example, to grab a frame every second from 00:03:00 to 00:04:00, the commend is:
ffmpeg -i "video.mp4" -start_number 0 -vf fps=1 -ss 00:03:00 -to 00:04:00 "C 00-03-%02d.500.png"

To verify them, we can extract all the frames from 00:03:29 to 00:03:31 :
ffmpeg -copyts -ss 00:03:29 -i "video.mp4" -start_number 0 -to 00:03:31 "D 00-03-29.%03d.png"

We may check the following image files are identical:
D 00:03:29.012.png is identical to C 00:03:29.500.png.
D 00:03:29.024.png is identical to B 00:03:30.000.png.
D 00:03:29.036.png is identical to C 00:03:30.500.png.

Those are my findings from trials and errors this morning. Here comes my question:
Let's take "extract a frame at exactly every minute" as an example, how can we get / what is the command to get the frames 00:00:00.000 , 00:00:01.000, 00:00:02.000 , and so on?
I have just heard of ffmpeg this morning. I still do not know what -copyts means (after reading the docs) and when I need to put -ss position before -i and when to put it at the output part. So please do correct me if I am using the wrong commands.

**Tags:** ffmpeg, framerate, timecode, video-capture, output


---

## 1 answers

### Answer by username_1 on 2024-03-08. Score: 0

I would say that you might be overthinking it a little. You could speed up the video mathematically (in an editor) and then extract all of the frames from that. For example in Blender we could, if it is 24fps, speed it up by 1440 times (to get 1 frame every minute) and then export all of the frames from the video as PNG or another format to a folder. I use this for time-lapses sometimes, and this way there is no scripting involved. I would still put the 23.98 into the equation to make sure you are getting the exact frames and not skipping over a couple.

Just multiply your fps by your increments in sec.

(fps\*sec)

Hope this helps!


---

