<p>After @Mulvya reply, I made the following changes:</p>

<p>First, I must put all in a single file.
According with the Mulvya answer, a "concat demuxed input" don't have a "fast seek", so, first I created a <code>gopro.txt</code> file with the following content:</p>

<pre><code>file 'GOPR0940.MP4'
file 'GP010940.MP4'
file 'GP020940.MP4'
file 'GP030940.MP4'
file 'GP040940.MP4'
file 'GP050940.MP4'
</code></pre>

<p>Then, "merged" all MP4 files in a single file, with the following command:</p>

<p><code>ffmpeg -f concat -i gopro.txt -c copy full_movie.mp4</code></p>

<p>Source: <a href="https://trac.ffmpeg.org/wiki/Concatenate" rel="nofollow noreferrer">https://trac.ffmpeg.org/wiki/Concatenate</a></p>

<p>Now, I can extract in a fast way individual frames, with the following command:</p>

<p><code>ffmpeg -ss 00:15:00 -i full_movie.mp4 -vframes 1 frame00001.jpg</code>.</p>

<p>Source: <a href="https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video" rel="nofollow noreferrer">https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video</a> (i put the -ss option first, like @Mulvya said).</p>

<p>Initially, I want to pass a list of timestamps to ffmpeg, but now, the extract of individual frames is very fast, that I don't need anymore. A simple batch file worked good.</p>

CC BY-SA 3.0
2017-03-22T16:30:10.263Z
2017-03-22T16:30:10.263Z
Roberto Correia
<p>I have a MP4 movie filmed with a GoPRO.</p>

<p>The GoPRO split the movie in several files (I believe because of FAT32 size limitation).</p>

<p>What I'm trying to do is extract some specific frames of the FULL MOVIE. I don't need all frames, but I need a list of frames</p>

<p>Because all files is from same movie, I "merged" all files. To do this, I created a file called gopro.txt with the following content:</p>

<pre><code>file 'GOPR0940.MP4'
file 'GP010940.MP4'
file 'GP020940.MP4'
file 'GP030940.MP4'
file 'GP040940.MP4'
file 'GP050940.MP4'
</code></pre>

<p>So, to extract a image from a movie, I used this command:</p>

<p><code>ffmpeg -ss 00:19:00 -f concat -i gopro.txt -qscale:v 2 -vframes 1 frame%d.jpg</code> (where 00:19:00 is the time I want).</p>

<p>Edit: as @Mulvya said, on a demuxed input, the "fast seek" don't work (works, but is very slow). So, I merged all videos on a single file with the following command:</p>

<p><code>ffmpeg -f concat -safe 0 -i gopro.txt -c copy full_movie.mp4</code></p>

<hr>

<p>Now, suppose I have a list of times I want to extract (I don't have the frame number, only the time), like:</p>

<ul>
<li>00:05:32</li>
<li>00:12:49</li>
<li>00:21:10</li>
<li>00:32:23</li>
</ul>

<p>and so on. My list will have more than 10.000 timestamps, so, if I make a batch file with:</p>

<pre><code>ffmpeg -f concat -i gopro.txt -ss 00:05:32 -vframes 1 frame00001.jpg
ffmpeg -f concat -i gopro.txt -ss 00:12:49 -vframes 1 frame00002.jpg
ffmpeg -f concat -i gopro.txt -ss 00:21:10 -vframes 1 frame00003.jpg
...
ffmpeg -f concat -i gopro.txt -ss 01:38:42 -vframes 1 frame10000.jpg
</code></pre>

<p>This will work, but take a really long time, because I think that ffmpeg, at each line of my batch file, will seek from beggining of the file until at desired time.</p>

<p>Edit: after changes proposed by @Mulvya, the extract worked very fast, and I can use the batch file without any problem.</p>

<p>It's possible to pass a list of timestamps to ffmpeg?</p>

<p>I tried with <code>select</code> option, like:</p>

<p><code>ffmpeg -f concat -i gopro.txt -vf select='eq(t,332)+eq(t,769)+eq(t,1270)+eq(t,1943)' -vsync 0 -vframes 4 frames%d.jpg</code>, (<a href="https://ffmpeg.org/ffmpeg-filters.html#Timeline-editing" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg-filters.html#Timeline-editing</a>) but got no results.</p>

<p>After several minutes, ffmpeg return a warning message with the following content:</p>

<p><code>Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)</code></p>

<p>And I thinking that solution it's not the best, because, if I have 10000 timestamps, this will generate a huge command.</p>

<p><strong>PS: I'm using Windows</strong></p>

CC BY-SA 3.0
2017-03-22T15:08:17.937Z
`ffmpeg -f concat -i gopro.txt -ss 00:05:32 -vframes 1 frame00001.jpg` --< this will take a long time, as this is a slow seek. `ffmpeg -f concat -ss 00:05:32 -i gopro.txt -vframes 1 frame00001.jpg` should not. Although since you are performing this on a concat demuxed input, it may amount to the same thing. But if you write the the concat to one MP4 and then set a seek time before the input, it's a fast seek and output will be quick. In a fast seek on a container like MP4, ffmpeg queries the index and jumps to the byte offset of the GOP start containing the sample.
Gyan
CC BY-SA 3.0
2017-03-22T16:10:17.947Z
@Mulvya, tested again! Yes, you're corrected. On a demuxed input, the results are the same. On a "merged" mp4, the second way is much faster.
Roberto Correia
<ffmpeg>
Extract multiples images from multiples videos with ffmpeg
Roberto Correia
# Extract multiples images from multiples videos with ffmpeg

(Asked by: username_0 on 2017-03-22)

I have a MP4 movie filmed with a GoPRO.
The GoPRO split the movie in several files (I believe because of FAT32 size limitation).
What I'm trying to do is extract some specific frames of the FULL MOVIE. I don't need all frames, but I need a list of frames
Because all files is from same movie, I "merged" all files. To do this, I created a file called gopro.txt with the following content:
file 'GOPR0940.MP4'
file 'GP010940.MP4'
file 'GP020940.MP4'
file 'GP030940.MP4'
file 'GP040940.MP4'
file 'GP050940.MP4'

So, to extract a image from a movie, I used this command:
ffmpeg -ss 00:19:00 -f concat -i gopro.txt -qscale:v 2 -vframes 1 frame%d.jpg (where 00:19:00 is the time I want).
Edit: as @Mulvya said, on a demuxed input, the "fast seek" don't work (works, but is very slow). So, I merged all videos on a single file with the following command:
ffmpeg -f concat -safe 0 -i gopro.txt -c copy full_movie.mp4

Now, suppose I have a list of times I want to extract (I don't have the frame number, only the time), like:

00:05:32
00:12:49
00:21:10
00:32:23

and so on. My list will have more than 10.000 timestamps, so, if I make a batch file with:
ffmpeg -f concat -i gopro.txt -ss 00:05:32 -vframes 1 frame00001.jpg
ffmpeg -f concat -i gopro.txt -ss 00:12:49 -vframes 1 frame00002.jpg
ffmpeg -f concat -i gopro.txt -ss 00:21:10 -vframes 1 frame00003.jpg
...
ffmpeg -f concat -i gopro.txt -ss 01:38:42 -vframes 1 frame10000.jpg

This will work, but take a really long time, because I think that ffmpeg, at each line of my batch file, will seek from beggining of the file until at desired time.
Edit: after changes proposed by @Mulvya, the extract worked very fast, and I can use the batch file without any problem.
It's possible to pass a list of timestamps to ffmpeg?
I tried with select option, like:
ffmpeg -f concat -i gopro.txt -vf select='eq(t,332)+eq(t,769)+eq(t,1270)+eq(t,1943)' -vsync 0 -vframes 4 frames%d.jpg, (https://ffmpeg.org/ffmpeg-filters.html#Timeline-editing) but got no results.
After several minutes, ffmpeg return a warning message with the following content:
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
And I thinking that solution it's not the best, because, if I have 10000 timestamps, this will generate a huge command.
PS: I'm using Windows

**Tags:** ffmpeg

> **Comments:**
> **username_1**: `ffmpeg -f concat -i gopro.txt -ss 00:05:32 -vframes 1 frame00001.jpg` --< this will take a long time, as this is a slow seek. `ffmpeg -f concat -ss 00:05:32 -i gopro.txt -vframes 1 frame00001.jpg` should not. Although since you are performing this on a concat demuxed input, it may amount to the same thing. But if you write the the concat to one MP4 and then set a seek time before the input, it's a fast seek and output will be quick. In a fast seek on a container like MP4, ffmpeg queries the index and jumps to the byte offset of the GOP start containing the sample.  
> **username_0**: @Mulvya, tested again! Yes, you're corrected. On a demuxed input, the results are the same. On a "merged" mp4, the second way is much faster.  

---

## 1 answers

### Answer by username_0 on 2017-03-22. Score: 1

After @Mulvya reply, I made the following changes:
First, I must put all in a single file.
According with the Mulvya answer, a "concat demuxed input" don't have a "fast seek", so, first I created a gopro.txt file with the following content:
file 'GOPR0940.MP4'
file 'GP010940.MP4'
file 'GP020940.MP4'
file 'GP030940.MP4'
file 'GP040940.MP4'
file 'GP050940.MP4'

Then, "merged" all MP4 files in a single file, with the following command:
ffmpeg -f concat -i gopro.txt -c copy full_movie.mp4
Source: https://trac.ffmpeg.org/wiki/Concatenate
Now, I can extract in a fast way individual frames, with the following command:
ffmpeg -ss 00:15:00 -i full_movie.mp4 -vframes 1 frame00001.jpg.
Source: https://trac.ffmpeg.org/wiki/Create%20a%20thumbnail%20image%20every%20X%20seconds%20of%20the%20video (i put the -ss option first, like @Mulvya said).
Initially, I want to pass a list of timestamps to ffmpeg, but now, the extract of individual frames is very fast, that I don't need anymore. A simple batch file worked good.


---

