[FFmpeg-user] Copying sections of an mp4 by time stamp
Moritz Barsnick
barsnick at gmx.net
Fri Aug 28 00:31:09 EEST 2020
On Wed, Aug 26, 2020 at 19:50:31 -0700, James Sundquist wrote:
> I'm looking to copy sections of example.mp4
>
> Ideally this would be by time stamp. Perhaps the time stamps are noted in
> a text file.
>
> Example as minutes:second
> 0:20 - 0:40 as a an mp4 with title "Exercise 1"
> 0:40 - 0:59 as an mp4 with title "Exercise 2"
> 0:20 - 0:59 as an mp4 with title "Primary Exercises"
In addition to the other answers, I have also had good success with the
"segment" muxer and its "segment_times" option, which takes a list of
cut ("segmentation") points in time. (I also add the "-reset_timestamps
1" option, to make each individual file's timestamps begin at 0.)
$ ffmpeg -i input.mp4 -c copy -f segment -segment_times 20,40,59,... -reset_timestamps 1 output.%02d.mp4
Moritz
More information about the ffmpeg-user
mailing list