I ended up using ffmpeg from the command-line to do the needful clipping.
After doing some research on this site and trying a few simpler commands I came up with the following command:
ffmpeg -ss 00:01:00 -i input.mp4 -ss 00:02:00 -c copy -to 00:05:10 \
output.mp4
As I understand it, with this command ffmpeg basically copies a portion of the clip from input.mp4 to output.mp4 (no re-encoding). ffmpeg seeks fast to the 1 min mark (the first -ss 00:01:00
), then starts looking for key frames, and outputs a clip from 3 mins into the clip (given by the second -ss
option) to 6 mins & 10 secs into the clip (specified by -to 00:05:10
). So this outputs a 3 min 10 sec long clip (5:10 - 2:00).
NOTE: times given by the 2nd -ss
option and the -to
option are relative to the time given by the first -ss
option.
To learn more about these and other options see the excellent answers to the question Using ffmpeg to cut up video.
This method was surprisingly fast (10-15 secs) but for the first 2-3 seconds of the clip the sound would be fine but without any correponding video. Both sound and video quality seemed indistinguishable from the original after those initial 2-3 seconds.
Dropping the -c copy
part solved that problem too. This does mean that video will be re-encoded — which takes longer (my late-2011 13" MacBook Pro took 80-90% of the runtime of the clip) — but audio and video quality were superb and file size was smaller than the original (calculated in terms of MB/min of playback)!
So the final command I settled on was:
ffmpeg -ss 00:01:00 -i input.mp4 -ss 00:02:00 -to 00:05:10 -strict -2 \
output.mp4
The -strict -2
part was added to the command based on suggestion from ffmpeg, as support for X.264 encoding is still experimental,
To use ffmpeg I downloaded the pre-compiled ffmpeg from ffmpegmac.net, put it in a directory that I already knew to be on my PATH
and was ready to go!