Android MediaCodec用于解码MPEG2视频流 [英] Android MediaCodec usage for decoding MPEG2 video stream

查看:665
本文介绍了Android MediaCodec用于解码MPEG2视频流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用MediaCodec API解码和显示MPEG2编码的流.我使用MediaExtractor从MPEG传输流(TS)中提取流.

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).

我注意到我尝试使用的所有设备上的解码器configure()均发生故障-Nexus7(2012),Nexus7(2013),Nexus10,错误代码为0x80001001.

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.

在使用configure() API时唯一可能出错的参数是提供的MediaFormat配置,该参数是从Android MediaExtractor获得的.我不明白是怎么回事,导致这个问题被注意到.

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.

MediaFormat对象中存在的配置参数为:

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`

该错误在所有设备上都有些相似,这可能意味着该错误可能源自MediaCodec堆栈中的一个公共实体.这是Nexus7(2013)的错误. (0x80001001 – OMX_ErrorUndefined)

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)

此行为是因为MPEG2不是Android平台上不支持的强制性编解码器,还是我做错了什么?有关MPEG2解码器行为的任何信息,将不胜感激.

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.

推荐答案

在设备上,查看/system/etc/media_codecs.xml以查看列表.

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

我的理解是,在当前的Nexus设备上,不支持MPEG-2视频压缩.

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

这篇关于Android MediaCodec用于解码MPEG2视频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆