Using ffmpeg to cut up video at multiple points

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

  1. Make input.txt containing the timestamps (in seconds) to cut:

    file 'input.mp4'
    inpoint 90
    outpoint 2850
    file 'input.mp4'
    inpoint 3180
    outpoint 6000
    
  2. Run ffmpeg to concatenate with the concat demuxer:

    ffmpeg -f concat -i input.txt -c copy output.mp4
    
  • 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 each inpoint timestamp in input.txt.