Enclosed are changes to ffmpeg which allows it to encode to .ty+ format. ffmpeg is superior to mplex for encoding to .ty+ format in that:
- ffmpeg's multiplexor, with the enclosed changes, can handle directv streams with video frames that sometimes contain 3 fields/frame. This is a common mpeg encoding scheme employed by directv but not seen in dvd compliant mpeg. mplex malfunctions in such cases because it fails to synthesize the correct timestamps to match the variable frame duration.
- With ffmpeg, one can now encode directly from .mpg or .vob to .ty+ without any separate demuxing step.
CREDITS:
- bcc for: The new libavformat encoding library for ffmpeg, TY master chunk processing library, XML record generation, TY chunk record streaming library.
- Nova1 for:
Original code demonstrating the relatively straightforward mapping from an elementary mpeg video stream to TY records
Original changes to more efficiently pack TY chunks
USAGE:
Notes: When specifying an a/v sync offset with -itsoffset, the order of the arguments matter.
Unlike mplex, ffmpeg won't work hard to glean the audio stream format, so if you're specifying that separately, you'll need to indicate whether it's ac3 or mpeg. In the following examples I do so by file name extension.
Converting from a .vob to .ty directly requires ffmpeg to identify the a/v streams. If it fails to do so (common it seems) you may still have to demux the streams first.
ffmpeg -i src.mpg -acodec copy -vcodec copy dest.ty
The above converts .mpg to .ty directly, without transcoding the video or audio
ffmpeg -i src.ac3 -itsoffset 0.798 -i src.m2v -acodec copy -vcodec copy dest.ty
In the above, the video stream start delayed 798ms after AC3 audio stream.
ffmpeg -i src.m2v -itsoffset 0.637 -i src.m2a -acodec copy -vcodec copy dest.ty
MPEG audio stream start delayed by 637ms after video stream.
COMPILING:
ffmpeg compiles under linux, and for windows, using cygwin.
- Unfortunately the ffmpeg project does not seem to be maintaining snapshots of their code, so first checkout the code from their SVN repository. The diffs were made against revision 5510, so if you checkout the same revision, the diffs should patch cleanly even if the mainline has diverged since then:
svn checkout -r 6543 svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
Or you could try the tivoserver snapshot of ffmpeg source.- cd ffmpeg
- patch -p1 < ffmpeg-diffs-xx.txt
- ./configure --enable-gpl --enable-a52 --disable-v4l --disable-dv1394 --disable-ffplay --disable-ffserver
- make
- make install
There is a support thread over here: http://www.dealdatabase.com/forum/sh...ad.php?t=50010


Reply With Quote
But you should probably be glad you didn't try - I had to do a bunch of wading through the ffmpeg code before I could get things to work and there were a couple nasty issues. In the end the diffs to ffmpeg came out pretty clean (cleaner than with mplex). So the ffmpeg API is fairly modular but their internals are poorly documented.

