One thing I loved about Quicktime 10 in Mac OS X (despite all its other shortcomings) was the ability to very easily trim a video file. I.e., I open the video in Quicktime drag two sliders to indicate the segment I want to cut from the video, then click Save As. All of this can happen very quickly.

I really want to recreate this ease in Linux (I am running the latest Fedora but would love a distro-adnostic solution), but so far the best I can do was to clip videos in OpenShot or Kdenlive. The problem there is that I need to export the segment resulting in re-encoding which takes much longer.

Is there a way to easily trim/clip videos in Linux? Thanks!


Not very quicktime-like, but this is what I do:

You can use avconv (Or ffmpeg, with a slightly different syntax than the one below), first open the file in any player, take the time at the start point, then the time at the end point, and then in a terminal:

avconv -ss 0:01:00 -i source.mp4 -codec:a copy -codec:v copy -t 00:02:00 a.mp4

For ffmpeg, it has to do something like this:

ffmpeg -ss 0:01:00 -i source.mp4 -acodec copy -vcodec copy -t 00:02:00 a.mp4

This will seek (-ss hh:mm:ss) one minute in the video, and then cut (-t hh:mm:00) two minutes.

The use of -codec:a copy -codec:v means to copy the audio and the video streams, so no re-encoding will happen.

Note that the -ss seeks the source, thus needs to be before -i, while -t stops writhing the output after a certain length, thus needs to be after it.

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