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

Click For Summary
SUMMARY

The discussion focuses on using FFmpeg to extract every frame from a specified range of an m2ts video file. The user aims to extract frames from 54 minutes to 55 minutes of a 2-hour video titled myvideo.m2ts at 60 fps. The correct command to achieve this is: ffmpeg -ss 3240 -t 60 -i myvideo.m2ts -r 1 output_%04d.png, where -ss specifies the start time and -t defines the duration of extraction. This method effectively limits the extraction to the desired one-minute interval.

PREREQUISITES
  • Basic understanding of FFmpeg command-line usage
  • Familiarity with video file formats, specifically m2ts
  • Knowledge of frame rate concepts, particularly 60 fps
  • Ability to interpret command-line options and syntax
NEXT STEPS
  • Explore advanced FFmpeg options for video processing
  • Learn about the -vf filter for applying video effects
  • Investigate batch processing techniques with FFmpeg
  • Understand the implications of frame extraction on video quality
USEFUL FOR

This discussion is beneficial for video editors, content creators, and developers working with video processing who need to extract specific frames from video files using FFmpeg.

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   Reactions: sysprog and member 428835
Amazing, thanks so much!
 

Similar threads

Replies
2
Views
915
  • · Replies 15 ·
Replies
15
Views
4K
  • Sticky
  • · Replies 13 ·
Replies
13
Views
8K
  • · Replies 56 ·
2
Replies
56
Views
54K
  • · Replies 21 ·
Replies
21
Views
5K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 71 ·
3
Replies
71
Views
17K