[mythtv] [PATCH] MPEG2->MPEG2 commercial cut (alpha verson 0.1)

Geoffrey Hausheer ou401cru02 at sneakemail.com
Fri Dec 12 14:02:08 EST 2003


I am including a very primitive MPEG2 commercial cutting application.

After a week of learning about MPEG2 and several different approaches, I
have one which shows promise.

I had initially coded up my own MPEG2 demuxer (which I have had no
problems with).  However, I gave up on trying to write the remuxing code,
and ended up using libavformat for that.  Since I was already using
libavformat anyway, I threw out my demux code, and used the demuxer in
libavformat as well.  This has the benefit that MPEG2-PS should work out
of the box (well, it doesn't work on the one sample I currently have due
to not detecting the audio).

Frames are cut to the GOP frame, so cutpoints are only ~0.5sec accurate.

The frame processing code is very fragile.  If your stream has any broken
frames, it won't work.  There is currently no sync code, so if the audio
and video start out of sync, they will stay that way.  Also, if any audio
or video frames are missing, they won't be detected, and things will get
more out of sync.

Also, I don't think it does very well with the end of the stream.

Needless to say, there is still a lot of work to be done, so I make no
guarantees about the code, and I wouldn't expect much from it at this
early stage (it is also quite a mess, containing remnants of several
failed attempts at getting it all working)

With all that said, here is what to do:
untar the archive somewhere
get the cvs version of ffpmeg (ffmpeg.sf.net)  for some reason libav*
from myth causes a segfault while trying to determine input format.
build ffmpeg (or at least libav*)
modify the Makefile and set LIBAV to point at your ffmpeg root dir.

make

./mpeg2cut -i <infile> -o <outfile> -c "<cutlist>"

The cutlist is specified as a space separated list of start-end pairs
(separated by a '-')
for example:
./mpeg2cut -i /varlib/myth/3_20031212120000_20031212123000.nuv -o
test.mpg -c "0-179 300-500 50000-999999"
(note the frames for the cutlist are the actual frame numbers, not the
gop/keyframe count)

Sorry the build process is so painful.  Until I find a way to work with
myths libav* or libav* is resynced with upstream, I can't build against
mythtv.

Feel free to let me know if it doesn't work for you, but unless you are
prepared to deliver a relevant mpg to me, don't expect much sympathy.  I
already have several streams which don't work that I need to debug.
  
.Geoff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mpeg2cut.tgz
Type: application/x-gtar
Size: 8082 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20031212/85353079/mpeg2cut.tgz


More information about the mythtv-dev mailing list