[mythtv] A prelude to transcoding MPEG2->MPEG2

Jim Paris jim at jtan.com
Sun Dec 7 16:05:19 EST 2003


> From my analysis, the way to go appears to be to demux the stream on the
> fly, clip out GOP chunks, rewrite the GOP header, and remux.

Do you need to demux the entire stream, or just in the vicinity of the
cut?

> I found a very good spec of the MPEG2-PS stream on one of the sites
> mentioned earlier

Out of curiosity, which site?

> Unfortunately MPEG2 is not designed for random access (there is no way to
> tell how big a given GOP with it's frames will be), so searching for
> headers is sort of slow.

Are the GOPs easily findable in a stream of data, and can you use the
timestamps to determine which they are?  If so, you could do a
binary-type search where you just seek to an arbitrary file position,
find the nearest GOP, and see where you ended up.

> This will all suck, because it requires a completely different code-path
> to deal with the MPEG2-MPEG2 case in the transcoder.  
..
> I'll probably start with implementing a standalone prototype which
> takes the cutpoints on the command line.  If that all works, we'll
> see how to best merge it with myth.

If it really shares little or no code with Myth, I'd recommend just
leaving it as a separate command-line utility, and just putting a
small stub in Myth to spawn it, with the reasoning being that there
are so many projects that want to do good MPEG2 cutting, and this
could be useful for all of them.

-jim


More information about the mythtv-dev mailing list