Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 1701  / 2 Years ago, mon, july 11, 2022, 1:24:56

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

More From » video

 Answers
2

  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.




[#1153] Wednesday, July 13, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
riffnkful

Total Points: 390
Total Questions: 123
Total Answers: 110

Location: Puerto Rico
Member since Sat, Mar 13, 2021
3 Years ago
riffnkful questions
;