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:
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