One thing that caught my eye was the subtle difference in the MPEG 1 vs
MPEG 2 Program Stream Pack header.
The standard I have, which describes MPEG-2 Systems (H.222) has a
slightly different bit definition in the headers than MPEG-1. Of
course, the test file I am using is MPEG-1, so I ran right into this
when I tried to parse the header !
Specifically I am talking about the binary '01' that is supposed to
follow the pack_start_code in the pack_header. In MPEG-1 this is
different.
So,
How do most decoders differentiate between MPEG1 & MPEG2 Systems
Streams ? Trial/Error ? Or is it always assumed the the decoder always
knows what's coming.
Thanks
-Chris
A video sequence header commences with a sequence_header_code and is
followed by a series of data
elements. In this specification sequence_header() shall be followed by
sequence_extension() which
includes further parameters beyond those used by ISO/IEC 11172-2. When
sequence_extension() is
present, the syntax and semantics defined in ISO/IEC 11172-2 does not
apply, and the present specification applies.
This means that if you have sequence header followed by sequence
extension, then it is MPEG-2 stream. Unfortunately it is not on system
layer, but on the video sequence layer and you'll have to demultiplex
the stream. All the decoders that I have seen are doing it this way.
If you search in ISO/IEC 13818-1: 1994(E) you'll see that in
video_stream_descriptor() there is MPEG_1_only_flag which defines the
type of the video elementary stream:
MPEG_1_only_flag -- This is a 1 bit field which when set to '1'
indicates that the video stream contains only
ISO/IEC 11172-2 data. If set to '0' the video stream may contain both
ISO/IEC 13818-2 video data and
constrained parameter ISO/IEC 11172-2 video data.
Now this is on system layer and you don't need demultiplexing. But I'm
not sure if all streams have this descriptor.
Regards,
Tsviatko Jongov
johngov at yahoo dot com
In ISO/IEC 13818-2: 1995 (E) you can see in sequence header
deffinition:
A video sequence header commences with a sequence_header_code and is
followed by a series of data
elements. In this specification sequence_header() shall be followed by
sequence_extension() which
includes further parameters beyond those used by ISO/IEC 11172-2. When
sequence_extension() is
present, the syntax and semantics defined in ISO/IEC 11172-2 does not
apply, and the present
specification applies.
This means that if you have sequence extension after the sequence
header, than it is a MPEG-2 stream
else it is MPEG-1. All the decoders that I have seen distinguish MPEG-1
from MPEG-2 video data
by looking for sequence extension after the sequence header.
Unfortunately it is not on the system layer, but on the video sequence
layer. So you'll need to
demultiplex the stream.