[FFmpeg-devel] [PATCH] n-th try to get the MPEG-PS demuxer functional

Michael Niedermayer michaelni
Sat Jul 12 22:35:43 CEST 2008


Hi

Patch below fixes issue49
Departed Trailer.evo (mpeg ps missdetecting h264 as mpeg2video)
(and possibly others)

I also would like to emphasize that mans claim of spec non compliance does
not seem to be true. The PSM is not a mandatory element in MPEG-PS not even
for H.264 in MPEG-PS

---
2.14.2    Carriage in PES packets
ITU-T Rec. H.264 | ISO/IEC 14496-10 Video is carried in PES packets as PES_packet_data_bytes, using one of the
16 stream_id values assigned to video, while signalling the ITU-T Rec. H.264 | ISO/IEC 14496-10 Video stream by
means of the assigned stream-type value in the PMT or PSM (see Table 2-34). The highest level that may occur in an
AVC video stream as well as a profile that the entire stream conforms to should be signalled using the AVC video
descriptor. If an AVC video descriptor is associated with an AVC video stream, then this descriptor shall be conveyed
in the descriptor loop for the respective elementary stream entry in the Program Map Table in case of a Transport
Stream or in the Program Stream Map, when PSM is present, in case of a Program Stream. This Recommendation |
                                     ^^^^^^^^^^^^^^^^^^^
International Standard does not specify presentation of ITU-T Rec. H.264 | ISO/IEC 14496-10 streams in the context of
a program.
---

The underlined part makes it clear that a PSM is not mandatory.


---
               Table 2-22  Stream_id assignments
Stream_id Note                                   stream coding
1011 1100  1     program_stream_map
1011 1101  2     private_stream_1
1011 1110        padding_stream
1011 1111  3     private_stream_2
110x xxxx        ISO/IEC 13818-3 or ISO/IEC 11172-3 or ISO/IEC 13818-7 or ISO/IEC 14496-3
                 audio stream number x xxxx
1110 xxxx        ITU-T Rec. H.262 | ISO/IEC 13818-2, ISO/IEC 11172-2, ISO/IEC 14496-2
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                 or ITU-T Rec. H.264 | ISO/IEC 14496-10 video stream number xxxx
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1111 0000  3     ECM_stream
1111 0001  3     EMM_stream
1111 0010  5     ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A
                 or ISO/IEC 13818-6_DSMCC_stream
1111 0011  2     ISO/IEC_13522_stream
1111 0100  6     ITU-T Rec. H.222.1 type A
----

And this part makes it clear that the ids are NOT reserved for mpeg1/mpeg2
video. They likely where reserved for mpeg1/2 in early versions of the mpeg2
spec which predated other video standards, but these
have been withdrawn or are superseded by above, which inlcudes a dozen
video coding standards.

Thus summary, MPEG-PS does not contain any mandatory element to identify the
used codec.

My patch corrects this by removing the claim that stream_id=1110xxxx would
be mpeg2video. It thus makes our demuxer comply more with the spec not less.

I will apply this patch in 24h unless there are objections from mans

Index: libavformat/mpeg.c
===================================================================
--- libavformat/mpeg.c	(revision 14080)
+++ libavformat/mpeg.c	(working copy)
@@ -459,7 +459,7 @@
         if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
             codec_id = CODEC_ID_CAVS;
         else
-            codec_id = CODEC_ID_MPEG2VIDEO;
+            codec_id = CODEC_ID_PROBE;
         type = CODEC_TYPE_VIDEO;
     } else if (startcode >= 0x1c0 && startcode <= 0x1df) {
         type = CODEC_TYPE_AUDIO;

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080712/e6440b1a/attachment.pgp>



More information about the ffmpeg-devel mailing list