Log in

View Full Version : How to trim MKV/MPEG2 file


esojmc
16th November 2008, 16:04
I captured a TV show into MPEG2 format and then used MeGUI to convert it to h.264+AAC into a MKV container. What I would like to do is to trim off the beginning (before the show starts) and the end (after the show ends). What's a good way to go about doing that? Is there a way I can do this in MeGUI? Is there a way to trim the original MPEG2 file? Or after the encoding, is there a way to trim the MKV file?

Thanks.

buzzqw
16th November 2008, 17:00
better to cut the original mpeg2.. just use avidemux

BHH

setarip_old
16th November 2008, 20:27
@esojmc

Hi!Is there a way to trim the original MPEG2 file?As an alternative, you could use "MPEG2Cut2.exe" (Not to be confused with the older "MPEG2Cut.exe")

AntiJw
18th November 2008, 18:26
..
Or after the encoding, is there a way to trim the MKV file?
Thanks.MKVToolnix can split MKV-files, although it don't seem to be able to split it the exact second you set it to split (it may split ~2 seconds after) :P

EDIT: At least not exact split with the x264-files (with b-frames) I tried to split. It may cut more exact (frame-accurate) with MPEG1-video, I don't know..
keywords: split cut trim

Adub
18th November 2008, 18:34
Yes, what AntiJW says is correct. MKVToolnix instead cuts on the closest keyframe. Which probably isn't exactly at the time stamp that you give it.

blizard
18th November 2008, 23:29
Yes, what AntiJW says is correct. MKVToolnix instead cuts on the closest keyframe. Which probably isn't exactly at the time stamp that you give it.

Yes and you (esojmc) would probably not be able to make a cut exactly where you want in an MPEG2 video either as you need to find a keyframe close to where you want to make your cut, but as MPEG2 is less compressed compared to H.264 as it (source) will likely contain more data to find a point where you can make a cut. I think that this is a common problem to most compressed format and H.264 is (ATM) a not very good codec to work in for editing purpose. This is due to the a way it compress image in highly efficient way.

AVIDemux would fit your need for cutting in MPEG2 (source) as you can use it in COPY mode without the need to re-encode your complete video, store it as MPEG2 (PS - Program Stream or TS - Transport Stream) for both sound and video (set COPY for both) and use what ever GUI to do the final encoding into MKV (h.264+AAC). AVIdemux do offer MKV and could also work for transcoding into h.264 (set video to x264) and audio into FAAC for AAC, but I am not sure how well MKV work in AVIdemux.

esojmc
25th November 2008, 20:42
Thanks for all the suggestions. What I do now is to cut the original MPEG2 file with mpeg2cut2 and it works great.

Thanks.

setarip_old
26th November 2008, 02:07
What I do now is to cut the original MPEG2 file with mpeg2cut2 and it works great.Glad to hear that my suggestion worked for you ;>}

Guest
26th November 2008, 02:13
Nobody mentioned cutting using Trim in your Avisynth script. That would be frame accurate. OP says he's transcoding, so...