m2v mp2 cut
m2vmp2cut 0.86 select
See NEWS for changes
m2vmp2cut is command-line driven frame accurate (currently PAL) mpeg2
video (m2v file) with accompanied mp2 audio (mp2 file) cutter.
A GUI tool is used for selecting the cutpoints.
Frame accuracy is achieved by re-encoding video around cutpoints.
Audio is cut from separate mp2 file at positions that keep a/v sync as
good as possible (maximum sync difference is around 10-15 milliseconds).
This program is licensed under the GPL v2. See file COPYING for details.
Note that 'm2vmp2cut' has pretty good help built-in. Executing 'm2vmp2cut'
or 'm2vmp2cut . help' will get to it...
$ m2vmp2cut demux
to demultiplex the source mpeg2, then execute GUI for cutpoint hunt:
$ m2vmp2cut select
is derived from original mpeg2 file by removing latest suffix
after dot (.) and replacing that with '.d'.
In order to 'select' to work the directory where m2v & mp2 files were demuxed
must have 'video.m2v' symlinked to the video and 'audio.mp2' to the video;
if those exist, the 'select' tool can be used to continue with content demuxed
by something else than m2vmp2cut.
After selection of cutpoints are done, the 'cut' command will create new
mpeg2 file from the selected contents, re-encoding some video frames to
achieve frame accuracy. Audio frames don't require any re-encoding.
Alternatively, there are some scripts in 'contrib' directory which can
re-encode the selected material to other formats. The 'contrib' command
will show available contrib scripts.
gtk2 -- gui library used by m2vcut
libmpeg2 -- for decoding mpeg2 pictures
Mjpegtools -- for mpeg2enc and mplex tools
ProjecX (project-x.sourceforge.net) -- to demux source mpeg files
Java runtime -- to run ProjectX (many non-sun vm:s work also)
Perl -- m2vmp2cut.pl (run frontend) is written in perl
Python -- some m2vmp2cut utilities are written in python
Posix Shell -- /bin/sh which has posix shell capabilities
(not just Bourne) (this is usually the case)
C compiler -- there are some C utilities that needs to be compiled
Java compiler -- if you need to compile ProjectX
Transcode -- for requantize option
(Other than ProjecX) Demux Tools (: (not used here (anymore))
Run 'm2vmp2cut help' to get more usage information.
WHY LIKE THIS:
Cutting demuxed files instead of mpeg2 file that has both audio and video
is done since:
1) Handling demuxed video file is easier; no messing with PTS, DTS and SCR
and so on (I saved development time).
2) I can't compete with such a good tool as ProjectX to get stuff out
of mpeg2 files.
3) Cutting separate audio and video files yields much better results cutting
audio and video on right places (near-perfect A/V sync if original has
so), for example using 48KHz 224 kbit mp2 files one 672 byte audio frame
contains 24ms of audio -- so A/V sync is at max 12ms off. If doing
'hard-cuts' in (multiplexed) mpeg2 files 1) audio packets contains like
2.6 audio frames and 2) audio packets might be far off in the file
the video packets with time close to each other...
Tools that helped to find out required information (Thanks to the authors!):
gopchop mpegcat tool
google searches: `mpeghdrs.html' (video) and `mpeghdr.htm' (audio)
google search: `python_mpeg'