Using ffmpeg to extract every n frames from a given range of an m2ts video

Click For Summary
To extract every second from a specific segment of a video using FFmpeg, the command should include the -ss option to specify the start time and the -t option to define the duration. For a video titled myvideo.m2ts, to extract frames from 54 minutes to 55 minutes, the command would be: ffmpeg -ss 3240 -t 60 -i myvideo.m2ts -r 1 output_%04d.png. This effectively captures one frame per second for the desired one-minute interval.
member 428835
Hi PF!

I have a video titled myvideo.m2ts that is 2 hours long at 60 fps. I would like to extract every second from 54 min to 55 min via ffmpeg. It looks like I would execute something similar to this: ffmpeg -i myvideo.m2ts -r 1 output_%04d.png except this will run the entire video. Any help is greatly appreciated!
 
Computer science news on Phys.org
Use the -ss option before the -i option like:
Code:
ffmpeg -ss 3240 -i myvideo.m2ts -r 1 output_%04d.png
as described in the online manual: https://ffmpeg.org/ffmpeg.html#toc-Main-options

Edit: oh, you only want 1 minute: use the -t option as well:
Code:
ffmpeg -ss 3240 -t 60 -i myvideo.m2ts -r 1 output_%04d.png
 
  • Like
Likes sysprog and member 428835
Amazing, thanks so much!
 
I’ve spent nearly my entire life online, and witnessed AI become integrated into our lives. It’s clear that AI is apart of us now whether we like it or not, unless your a anti tech cabin lover. AI has some form of control over your life. But what I’ve seen very recently is that people are loosing their ingenuity and deciding to use AI. I feel as if it’ll bleed into STEM which is kinda has already and, every idea or thought could become fully reliant on AI. Yeah AI makes life easier but at a...

Similar threads

Replies
2
Views
771
  • · Replies 15 ·
Replies
15
Views
4K
  • Sticky
  • · Replies 13 ·
Replies
13
Views
7K
  • · Replies 56 ·
2
Replies
56
Views
53K
  • · Replies 21 ·
Replies
21
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
Replies
6
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
Replies
71
Views
17K