[mythtv] transcoding with cutlist

Geoffrey Hausheer ou401cru02 at sneakemail.com
Wed Aug 13 11:36:33 EDT 2003

On 13 Aug 2003 07:17:00 +0200, "Martin Moeller martin-at-martinm-76.dk
|mythtv/1.0-Allow|" <mvx1hgfxer0t at sneakemail.com> said:
> ons, 2003-08-13 kl. 01:39 skrev Geoffrey Hausheer:
> [musings about fifos and mencoder/mythtranscode interaction]
> > Well, a couple of minutes work, and I have a crude hack that writes out
> > raw audio and video to two sepearate files from withing mythtranscode.  I
> > was then able to build a divx from those raw files using mencoder, so I
> > assume this can be done with named pipes too.  It should also allow
> > working with mpeg4 and mp3 files such that mencoder doesn't need to
> > reencode the files (I haven't tried any of that, i'm just guessing).  the
> > down side will be that there is no longer any audio/video sync info, and
> > with dropped frames/commercial cuts, it is likely that there will be
> > audio drift.
> > 

First, I should mention that this only works with CVS mplayer.  the 0.91
and earlier versions don't support using -audiofile with -rawvideo

> Okay, well it's a great start I'd say. Most of the shows I want to
> archive only have 'junk' at the beginning and end, no advertising in the
> actual broadcast (that is not always the case but for most of my needs
> it is). I would like to test it on a couple of files when you feel
> you're ready for that.

I'm still working on a viable solution

> > Not sure what to do about that.  Perhaps files can be synced in
> > mythtranscode, but I'm not really sure how.
> Good question. Maybe the extra frames 'hack' from mythmkmovie after each
> cutpoint will do the trick? Alternating 14 and 15 extra video frames I
> believe it was... (black frames).

This will be nasty.  I think it can be done by looking at timecodes, but
I haven't thought about it much.  I think audio-sync will require using
decompressed audio.

> If you can manage to write out separate mpeg4 and mp3 streams and get
> mencoder to splice that it's basicallya home run :) - I guess raw video
> takes up a LOT of space...

I'm not really sure how viable this is yet.  I want to get it working
well with raw data first.  After lots of playing with it, I've found that
mplayer hates fifos.  It refuses to work with them.  This really makes
things hard, since uncompressed data is really big, and we don't really
want to keep it around.

My current solution is the following:
in mythtranscode, I write video to a fifo (vidout) and audio to a file

then I can start mplayer like:
cat vidout | mplayer -rawvideo on:w=640:h=480 -audiofile audout
-audio-demuxer 20 -rawaudio rate=32000 -
the mencoder line looks like:
cat vidout | mencoder -rawvideo on:w=640:h=480 -audiofile audout
-audio-demuxer 20 -rawaudio rate=32000 -ovc lavc -oac mp3lame -o out.avi

and it plays video from the fifo and audio from the file.  The problem is
that it may be possible to underrun the audio.  You also end up with a
raw audio file on your disk when you are done, which takes up ~128kB/sec
or 461Megs/hr (at 32kbps sample rate).

If there is an interest in this (you'll need to delete the audio file
when done), I will continue working on it.  Assuming I can get the audio
and video synced, this will give a solution for going from nuv to
divx/avi without an mencoder patch.  As to whether it can be done without
recompressing the video stream (as I said, the audio stream will almost
certainly need to be recompressed to maintain sync), I don't know yet.

If anyone knows any clever ways to make mplayer work with named-pipes,
I'd be glad to hear them.


More information about the mythtv-dev mailing list