Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to cut out parts of a video (+ the associated audio, of course) to make a short clip. For example, take 2 minutes from one location, 3 minutes from another part of the video, 30 seconds from another location and join it all together to form one single clip. The format of the input video is mp4 (H.264 encoding, AFAICR).

Don't need very sophisticated merges or transitions from one part to the next, or sophisticated banners (text) on-screen, but some ability to do so would be a plus point.

I've done this with iMovie in the past, but where the original file was under 5MB/min of play time, the chopped-up version was over 11MB/min of play time, which to me seems really bad.

Is there a better/different way of doing this on OS X?

Looking for free (gratis) solutions.

OS: OS X 10.9.3

share|improve this question

2 Answers 2

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!

share|improve this answer
1  
Note that if you want to control the quality of the clip when dropping -c copy, you should use the options mentioned here: trac.ffmpeg.org/wiki/Encode/H.264, basically -crf 23, and choose a lower value for better quality (sane values between 18–28). –  slhck Jun 14 at 7:10

Quicktime's Split and Trim functions can be used to quickly pare a video clip down to size.

If all segments are from the same file, Quicktime can easily be used to split, re-arrange, and trim clips:

Open the original in Quicktime, cue ahead at least one frame to the spot of your first cut, and under the Edit menu, Split Clip will be un-greyed. Cmd-Y is the shortcut. QTs control panel will switch to a clip-view mode, showing two additional clips with a division at the playhead's current spot, both clips highlighted in yellow. To delete an unwanted clip after a Split Clip operation, click on the clip in the timeline to highlight it, and hit Backspace, or select one of the functions commonly found under the Edit menu. In the "Clip View" mode, clips can be dragged and dropped to re-arrange their order. Once finished splitting clips, click the Done button on the right to resume normal QT operation.

Moving on, it's now time to either Save the file in its current format, Export the file in a different resolution, or Share the file with one of the services. The latter two are under the File menu, but Save is conspicuously missing: No worries... Just click the edited clip's window red X in the upper left corner to close the window. This will bring up the familiar Save dialog box, and A/V files I've saved this way have kept all the properties of the original clip intact. Exporting or Sharing is more likely to cause the video to be resampled, and possibly grow in size as yours did.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.