I have a video that is a football game. I would like to cut the time before the game
, during half time
and finally the end of the game.
Total Clip Length 1h 51m
or 111m
Ideally the cuts and time are as follows:
+------------+-------------+---------------------+
| Start Time | Finish Time | Clip Duration |
+------------+-------------+---------------------+
| 1:30 | 47:30 | 47:30 |
| 53:00 | 100:00 | 47 |
+------------+-------------+---------------------+
However my video finishes at
ffmpeg -ss 00:01:30 -i Tripod_Camera.mp4 -t 00:47:30 -ss 00:53:00 -t 00:47:00 -c copy VideoClip.mp4
Make
input.txt
containing the timestamps (in seconds) to cut:Run
ffmpeg
to concatenate with the concat demuxer:This will stream copy, so no re-encoding occurs meaning the whole process will be fast and quality will be preserved. However, cuts will be made on keyframes, so it may not be accurate enough. If greater accuracy is needed you'll have to use a much slower method such as using the (a)trim, (a)setpts, and concat filters which requires re-encoding.
If you get A/V desync then get timestamps of keyframes, use keyframe timestamps as your
inpoint
, but add 0.001 to eachinpoint
timestamp ininput.txt
.Use Videocut which I've written for this purpose. Due to its own muxer it is more precise than ffmpeg and provides your with a graphical interface.
Since it is based on ffmpeg (or its libraries) the cutting is lossless.