15

I have some DRM-free m4v video that I would like to edit by trimming here and there.

  • QuickTime X ($0)

    • Pros: free, built-in to OS X
    • Cons: selector to choose 'start' and 'end' times is not very easy to use to get precise in/out
  • iMovie ($15, or free if you have bought a recent Mac)

    • Pros: free
    • Cons: can't handle mp4/m4v directly, has to be re-encoded [I believe]
  • QuickTime 7 Pro ($30)

    • Pros: Can make very precise (to the frame) edits
    • Cons: saves only as .mov not .mp4/.m4v
  • SimpleMovieX ($40)

    • Pros: claims to be able to do this (although I tried the demo and found the UI so terrible I can't even verify if it works, and if it does, if it does anything that QuickTime X cannot)
    • Cons: appears to be 'abandonware' as it hasn't even seen a minor update in well over a year, MacUpdate reviews are nearly entirely negative, going back to 2009, including slow- or no- responses from the developer.

Are there other good options out there*? If so, what are they, and what are their pros/cons?

* I specified "good" because Google is useless for topic as the results are littered with sites offering “reviews” of software that by some mere coïncidence they also happen to sell. (Most of the sites and most of the software appear very similar as well.) There's clearly a lot of crap out there

  • I've never figured out exactly how, but sometimes iMovie will import mp4/m4v files without re-encoding. I don't know if there's any way to find out precisely how it decides, but it may be based on specific H.264 options, quality, length, or even just the audio track... if you can figure that out it may be the best option. – drfrogsplat Jan 22 '14 at 5:57
  • squared5.com/svideo/mpeg-streamclip-mac.html is another option that I should have included. If I had to do a project today, that would probably be what I would use. – TJ Luoma Mar 12 '15 at 13:09
  • The codec (H264) is what matters. As long as you aren’t re-encoding the m4v, you are editing it losslessly. – njboot Mar 13 '15 at 7:38
  • Daniel - are any sample MP4 videos online? (either a sample video from the same camera or could you post here your requirements for what specific encoded content/codec is inside the mp4 container? Perhaps a video from iTunes U would be equivalent? – bmike Mar 14 '15 at 14:38
11
+250

iMovie (not lossless, but better than before)

iMovie v10 (released some time after the question was originally asked) now better handles more media types, so avoids the import re-encode for most H.264 (mp4, m4v, mov, AVHDC, mts, mt2s) content.

It will still, however, re-encode on export so cannot be technically lossless—another new feature, however, is the ability to customise the export quality, which can be closer-to-lossless. I suspect this part of the answer can apply equally to other 'project driven' video editing software (e.g. Premiere or Final Cut) because I think they all generally re-encode on output, though are usually very easy to use for precise trimming.

Personally, I generally think a single re-encode isn't a huge problem, but understand you did specifically ask for a lossless solution, so...

Lossless (but way more complicated!)

There are technical limitations as to how precisely you can cut a video without having to re-encode at least some part of it, and it basically depends on the i-frame frequency. If every frame is an i-frame, you can cut anywhere, but if they're only every few seconds, then you can only cut losslessly at those i-frames without losing content or having to re-encode (at least part of the stream) so it can start with an i-frame.

ffmpeg

This SO Q&A specifically raises the question of how to cut between i-frames using ffmpeg. I don't know of any GUI apps to do this, but basically you run a command something like the following:

ffmpeg -i input.m4v -vcodec copy -acodec copy -ss 00:01:20.000 -t 00:37:50.000 output.m4v

The two times specified are start and duration, and can be specified either as seconds or hh:mm:ss.ss, and the -acodec copy and -vcodec copy tell ffmpeg not to re-encode.

I'm not exactly sure what happens if you cut too early, but I think the video is essentially blank (or maybe corrupt, depending on player) until it encounters an i-frame. So you'll probably want to find the nearest i-frame before your cut. This answer solves that problem using ffprobe and awk, albeit a little awkwardly. Essentially you use ffprobe to scan the frames and find the nearest keyframe (flags=K) before your ideal cut-point. Full output for each frame of the video can be seen like this:

ffprobe -select_streams v -show_frames <INPUT>

The linked answer supplies this command to find a keyframe before a specific time:

ffprobe -select_streams v -show_frames -v quiet INPUT.mp4 | 
awk -F= ' 
  /pict_type=/ { if (index($2, "I")) { i=1; } else { i=0; } } 
  /pkt_pts_time/ { if (i && ($2 >= 150)) print $2; }  
' | head -n 1

And finally, if you really need to cut somewhere between two i-frames, you can split the video and re-join. Based on the info from this answer, it should be something like:

ffmpeg -f concat -i list_of_videos.txt -c copy OUTPUT.mp4

Where list_of_videos.txt is a simple text file listing the files you want to concatenate.

Summary

iMovie is probably good enough for most cases (since v10), and very easy.

ffmpeg can do it losslessly (or very close to losslessly), with a bit of fiddling; level of difficulty depends on how picky you are about the precise starting point, and frequency of i-frames.

  • 1
    I'm most worried about the time involved in re-encoding (these are many multi-hour long videos that I'm taking a few minutes off of), but ffmpeg looks promising! – Daniel Mar 13 '15 at 1:24
  • Ah okay, for long videos its reasonably likely (depending entirely on encoding source) that the i-frames will be up to 10s apart, so that may be an issue if you want to trim them more precisely. The splitting, re-encoding of the first <10s and concatenation should work, but would not be fun to repeat many times. – drfrogsplat Mar 13 '15 at 6:50
7

I made a graphical tool that uses ffmpeg to let you losslessly trim videos by selecting the start and end points on the timeline: https://github.com/mifi/lossless-cut

It is open source and cross platform.

  • 1
    This is a good tool and greatly simplifies the process of using ffmpeg to edit a video. The graphical UI helps sooo much. Highly recommended. – John Mark Mitchell Mar 13 '17 at 4:02
  • Fantastic super-simple tool. @Mikael, thanks for making it! – Michael Zlatkovsky - Microsoft Aug 7 '17 at 14:51
  • Does not work with 10-bit 4K MP4 videos, unfortunately. – Mattis Dec 30 '17 at 0:15
5

Quicktime 7 Pro ($30)

Open your video. If you want to see the exact frame number: in the lower left, click on the timer to switch to "Frame Number" display.

lowerleft

Select the start point (type i when you are there) and end point (type o when you are there).
select
Move one frame at a time with the arrow keys; or drag the little handles on the bottom. (Here we see the end is at frame 1330.)

In the Edit menu, choose "Delete" to get rid of the selected portion, or choose "Trim" to get rid of everything else.
crop

Although Quicktime 7 will save only in MOOV format, it will export in many formats. Export as MPEG-4 (for example) and avoid re-coding by choosing option "Pass through"

options

  • This answers part of the question, but not how to actually use the program to trim video. – Daniel Mar 12 '15 at 1:09
  • OK, I thought the OP understood the rest. But I will put it in anyway. – GEdgar Mar 15 '15 at 21:54
  • Editorial: Is Quicktime X as good as Quicktime 7 yet? I haven't used Quicktime X for years. – GEdgar Mar 15 '15 at 22:19
  • I just ran into essentially the same need, and found that QT7 was by far the easiest and fastest way to solve the problem. apple.stackexchange.com/a/298690/24706 – Jonathan van Clute Sep 16 '17 at 21:05
2

Final Cut Pro X ($299.99) This is one of the best video editing software for mac. With professional quality editing, you can export the files as a higher, lower, or in the same format as before. To use the editor, you can use the blade tool in the non-linear editor to cut parts of the video, or to change the 2.1 surroundsound to 5.1. It also has a multiformat timeline.

DaVinci Resolve 11 - There are three versions of this software. DaVinci Resolve Lite ($0). Davinci Resolve Software ($995), or Davinci Resolve ($29,995) This is some of the best software to date. Known for its color correction capabilities, DaVinci Resolve will allow for multi format editing, has many transitioning capabilities, keyframing, awesome plugins, collaboration features, and the ability to go from mac to Windows. It will also allow for you to upgrade your surround sound, and allows for re-framing, and does not create proxy media. For precision editing, and for non-3d video the lite version is for you. 8GB of RAM is recommended.

Both of these products allow for non-linear editing and abilities to upgrade your media to an uncompressed format for faster export to DVD.

0

You should be able to toggle between frames in Quicktime Pro with the arrow keys. It's certainly not as easy as using Avid, Final Cut, Premiere, etc. but it's doable. You can make your Marks move with the arrow keys, too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .