Project

General

Profile

Cutting the beginning and end off a recorded file

Added by Andy Lear over 13 years ago

Hi,

This may well be a daft question, but is there a nice easy one line command that will allow me to take off the first 5 minutes say of a recording and the last 2 minutes whilst maintaining the rest of the file, ie audio and video and subtitles just copy for the section I want?

I have tried things like this:

mencoder -ss 00:05:44 -oac copy -ovc copy -idx recorded_file.mkv -o output.mkv

but get really strange results.

eg. in mplayer the sound is fine but the video is really sped up, however in vlc the video is fine, but no sound!

Any help is much appreciated

Andy


Replies (26)

RE: Cutting the beginning and end off a recorded file - Added by Kerat 1 about 7 years ago

Stéphane Bidoul wrote:

Hi Markus,

Last year I also tried to find a solution to cut mkv files easily and never found something that was suiting my tastes.

So I resolved to write mine. It's working quite nicely to fit my needs, but I never got the time to package it.

Since you seem to have just the same requirements, I just pushed the code on github (https://github.com/lesbi/edledit)

What you'll find there is a small GUI program (edledit/edledit.py) to preview a mkv file, and create cuts. There is a variety of shortcuts to start/end cuts, move by adjustable steps in the movie (including shortcuts to reduce the step size and move forward or backwards in one operation, to quickly zero-in on the point where you want to cut).

edledit saves the cutlist as an edl file (http://www.mplayerhq.hu/DOCS/HTML/en/edl.html), which can be interpreted natively by mplayer and XBMC.

If you want to definitively remove the cut parts, you can then run the included mkvedlmerge which will read the edl file and call mkvmerge to split the mkv and merge it again without the cuts. Be careful: while edledit is most probably harmless, mkvedlmerge may wreck havoc with your precious movies, so please test it before doing anything serious with it...

Let me know what you think.

Best regards,

-sbi

Stéphane,
this tool looks exactly like what I am trying to do. Specifically, I would like to:
1. Use comskip to create an edl file that enumerates the commercials.
2. Use mkvmerge to split the video at and after the commercials.
3. Merge the video back together without the split commercials.
I have installed mkvtoolbox, and python on my system. How do I run mkvedlmerge?

(26-26/26)