3

I am trying to use MediaCodec API to decode and display an MPEG2 encoded stream. I use MediaExtractor to extract the stream from an MPEG Transport Stream (TS).

I notice that configure() of the decoder is failing on all devices that I have tried - Nexus7(2012), Nexus7(2013), Nexus10, with error code 0x80001001.

The only parameter that can go wrong in using the configure() API is the MediaFormat configuration provided and this is obtained from the Android MediaExtractor. I do not understand what could be going wrong resulting in this issue getting noticed.

The configuration parameters present in the MediaFormat object are:

            1. `CSD-0` - Containing Sequence header and sequence extension header.

                            Seq_Hdr    - 00 00 01 B3 2D 01 E0 24 09 C4 23 80 

                            Seq_extnsn - 00 00 01 B5 14 8A 00 01 00 80

            2. Height - 480

            3. Width - 720

            4. KEY_MIME - `video/mpeg2`

The error is somewhat similar on all devices, which might mean that the error is perhaps originating from a common entity in the MediaCodec stack. Here is the error from Nexus7 (2013). (0x80001001 – OMX_ErrorUndefined)

E/ACodec  ( 6504): [OMX.qcom.video.decoder.mpeg2] configureCodec returning error -1010
E/MediaCodec( 6504): Codec reported an error. (omx error 0x80001001, internalError -1010)

Is this behavior because MPEG2 is not a mandatory codec to be supported on Android platforms or am I doing something wrong? Any information on the behavior of MPEG2 decoder will be greatly appreciated.

Ganesh
  • 5,790
  • 2
  • 34
  • 54
b_s_anoop
  • 63
  • 1
  • 5
  • Looks like on Android 4.4 and older , MPEG2 isn't supported by MediaCodec API. If you look at MXPlayer's HW+ logcat output, it appears that MXPlayer uses libstagefright(or C++ API) directly, not MediaCodec API. – Yi Wang Sep 20 '14 at 05:27
  • Also look at ACodec.cpp:SetComponentRole(), it looks like Android check for mime type and return not-supported error(-1010) if mime isn't in a list. (hint: mpeg2 isn't in the list) – Yi Wang Sep 20 '14 at 05:28
  • I have the same issue, and I guess it's related to `csd`. The question is, how do you know the MPEG2's codec expects `Sequence Header` and `Sequence Extension`as 'CSD-0'? I didn't find any information how to set `CSD` for MPEG2 codec. – Mine Feb 03 '15 at 06:39

1 Answers1

1

On your device, look at /system/etc/media_codecs.xml to see the list.

My understanding is that, on current Nexus devices, MPEG-2 video compression is not supported.

fadden
  • 48,613
  • 5
  • 104
  • 152
  • I have looked at the codec list and MPEG-2 is present in this list. In fact, MX Player supports the HW+ mode on this device for MPEG-2 clips, which means the device supports Hardware accelerated MPEG-2 decoding. – b_s_anoop May 19 '14 at 08:27
  • What does the list entry look like? On which device? – fadden May 19 '14 at 14:39
  • Ah, found it in the `` section on Nexus 7 (2013). I don't see it on N5 or N10. – fadden May 19 '14 at 18:10