[mythtv] A prelude to transcoding MPEG2->MPEG2
doug at ties.org
Sat Dec 6 09:49:38 EST 2003
On 12/06/03 00:17:14, Geoffrey Hausheer wrote:
> MPEG2 is further complicated by B-Frames, which means that the
> end-point needs to be cut to the nearest P-Frame or I-Frame, so you
> could end up with a few extra frames after the start of the cut-point
> in either of the above methods.
Each GOP should be self-contained, iirc. Just continue re-encoding
after the cut until you get to a whole, untouched GOP.
> There is also the question of how audio and video are muxed together.
> My understanding is that the 'PES' consists of a series of GOPs and
> audio sections. So I am not sure how to get frame accuracy without
> building new PES and possibly needing to reencode the audio.
One would hope that the audio packets would line up on GOP boundaries.
If not, or if you're reencoding video, you're gonna end up reencoding
audio as well -- either MPEG2 layer 3 (there are a few encoders to
choose from for this one :-) or AC3.
> However, if anyone knows where I can find a reasonable spec for the
> MPEG2 stream format, I'd be much obliged. My google searching has
> turned up lots of useful stuff, but not enough for me to really
> understand how to begin (for instance I've been able to find zilch on
> the actual PES and GOP formats.
Yes, this is a PITA. Even the dead-tree documentation in this field is
expensive :-( I've learned what little I know mostly by reading source
> Also, everything I've looked at has been MPEG2-PS related. the 'TS'
> variety seems to be quite a bit more complex, and if DVB uses it (as
> I suppose it does...'TS' being 'Transport Stream'), it will cause
> much woe, so if anyone knows anything about that, it'd be useful too.
There's actually a good amount of info on MPEG-TS available in the ATSC
(HDTV) standards freely available from www.atsc.org (in PDF). Quick
MPEG-TS (transport stream) multiplexes individual MPEG-ES (elementary
stream) streams (video and audio) from one or more programs, and breaks
them into 188-byte packets for ease of transmission. Each packet has a
PID (program identifier) that shows what stream it belongs to, as well
as (optionally) other info to help in classifying the packets without
decoding their contents. The stream also includes table-of-contents
information (PAT, program association table--always at PID 0, and PMT,
program map table--one for each program). It can also contain other
non-video data in a semi-standard table format; this is used in HDTV
for PSIP (program and system information protocol)--guide data etc.
Both HDTV and (I believe) DVB store their recordings on disk in MPEG-TS
in order to avoid having to translate the video into MPEG2-PS at record
time, which in principle is trivial but we don't quite have code to do.
It's probably worthwhile to insert code into transcode to do so, and
then commercial editing would just work.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20031206/0f90c6f2/attachment.pgp
More information about the mythtv-dev