OMX.google.aac.encoder do not work in MediaCodec when encode pcm to aac

落花浮王杯 提交于 2019-12-10 11:50:54

问题


I am encoding pcm track of wav file into aac using MediaCodec on Android 4.1, on my S3, there are two encoders, OMX.google.aac.encoder and OMX.SEC.aac.enc, the first one is used if call createEncoderByType, but it does not work, the output can't be played(has no sound), if call createByCodecName with "OMX.SEC.aac.enc", it works. While on my HTC ONE, there is only "OMX.google.aac.encoder", and does not work. I think my code has no problem, because it was copied from google, and the second encoder works.

BTW, I added adts header to the aac stream.


回答1:


On my Nexus 5, MediaCodec.createByCodecName() never seems to work when passing names of encoders (as specified by MediaCodecList).

The AAC encoders on my Nexus 5 (4.4.4):

name: OMX.google.aac.encoder types: [audio/mp4a-latm]

name: AACEncoder types: [audio/mp4a-latm]

This works however:

MediaCodec.createEncoderByType("audio/mp4a-latm");

Note: curiously, when calling this method the logs reveal:

A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.

which is kind of odd.

So if this is not working for you, then it is probably in your implementation of the encoder rather than MediaCodec creation.



来源:https://stackoverflow.com/questions/20768695/omx-google-aac-encoder-do-not-work-in-mediacodec-when-encode-pcm-to-aac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!