Thought I'd document the process I used for trimming down my React conf demo videos in case it might be useful to someone else in the future.
Let's say I have a 40 second video named original-video.mp4
, and I want to only keep the following sections (in seconds): 1-8, 10-11, 20-33
I could create 3 chunks using ffmpeg
like so:
ffmpeg -i original-video.mp4 -ss 1 -t 7 piece-a.mp4 -ss 10 -t 1 piece-b.mp4 -ss 20 -t 33 piece-c.mp4
Then write the names of these pieces to a text file:
cat >> video-pieces.txt << EOF
file 'piece-a.mp4'
file 'piece-b.mp4'
file 'piece-c.mp4'
EOF
Then lastly, use ffmpeg
to stitch them back together into a single file:
ffmpeg -f concat -i video-pieces.txt -c copy trimmed-video.mp4
I know other tools (like QuickTime) let you trim, but I don't know if they let you splice sections out. (I'm not a QuickTime power user.) The above is pretty easy and fast though so...hope it helps someone!
This is super neat! Having simple command line recipes like this is awesome, thanks for sharing!
If you do want to know how to replicate this inside QuickTime, I’ve done similar things with the split & trim tools. (It has been a while!) https://support.apple.com/en-us/HT201066#edit