简体   繁体   English

Android MediaCodec.createEncoderByType-多个编码器可用,应该/将使用哪个编码器?

[英]Android MediaCodec.createEncoderByType - Multiple encoders available, which one should/will be used?

My question is similar to this one Mime type video/avc supported by multiple encoders on my Android device but not quite the same. 我的问题与我的Android设备上的多个编码器支持的这一Mime类型视频/ avc类似,但并不完全相同。

In all Samsung devices I have, I see that there're multiple encoders available for MIME type "audio/mp4a-latm": 在我拥有的所有三星设备中,我看到MIME类型“ audio / mp4a-latm”有多个编码器可用:

OMX.google.aac.encoder
OMX.SEC.aac.enc (Android < 5)
OMX.SEC.naac.enc (Android >= 5)

MediaCodec.createEncoderByType would return the optimized one, I would think. 我认为,MediaCodec.createEncoderByType将返回经过优化的代码。 But on all the Samsung devices I have, this method always create the Google encoder. 但是在我拥有的所有三星设备上,此方法始终会创建Google编码器。 Problem is when I compare the time spent to create the two encoders, creating a google encoder is much slower than creating the samsung encoder. 问题是当我比较创建两个编码器的时间时,创建Google编码器比创建三星编码器要慢得多。

Then WHY would MediaCodec.createEncoderByType return the slower encoder? 那么,为什么MediaCodec.createEncoderByType返回较慢的编码器? Should I still be using the google encoder if that is much slower? 如果速度慢得多,我应该继续使用Google编码器吗? (Takes like a few hundred ms). (大约需要几百毫秒)。 Or should I iterate all available encoders and choose the samsung one instead? 还是应该迭代所有可用的编码器,然后选择三星编码器?

Thanks! 谢谢!

In practice, the method MediaCodec.createEncoderByType (and MediaCodec.createDecoderByType ) only returns the first matching codec, in the order they are listed. 实际上,方法MediaCodec.createEncoderByType (和MediaCodec.createDecoderByType )仅按列出的顺序返回第一个匹配的编解码器。 A vendor can either make sure to order the list (it's in practice in /etc/media_codecs.xml on the device) to list the preferred ones first, or override the implementation of the methods to use a different logic than just picking the first matching. 供应商可以确保对列表进行排序(实际上是在设备上的/etc/media_codecs.xml )以列出首选列表,或者重写方法的实现以使用不同的逻辑,而不仅仅是选择第一个匹配项。 。

In this case, it seems like Samsung haven't thought about this, or their own hardware AAC encoder is less featureful than the google SW encoder, like supporting fewer profiles/options. 在这种情况下,三星似乎没有考虑这一点,或者他们自己的硬件AAC编码器的功能不如google SW编码器,例如支持的配置文件/选项更少。

I guess they have made sure that at least the HW codecs for video are listed first, since the difference in speed there is much more significant. 我猜他们已经确保至少首先列出了视频的硬件编解码器,因为那里的速度差异要重要得多。

If you are concerned with speed, you can indeed try to pick the Samsung one instead. 如果您担心速度,则可以尝试选择三星。 Or conversely, instead of explicitly looking for the Samsung ones, you can be pretty sure that any codec starting with OMX.google. 或者相反,您可以肯定地确定任何以OMX.google.开头的编解码器都可以,而不必明确地寻找三星的编解码器OMX.google. is a SW codec. 是SW编解码器。 So first you can look for the first matching one that doesn't start with OMX.google. 因此,首先您可以查找第一个不以OMX.google.开头的匹配OMX.google. . If no such encoder is found, you can iterate another round, picking the first matching one (or use MediaCodec.createEncoderByType ). 如果找不到此类编码器,则可以迭代另一轮,选择第一个匹配的编码器(或使用MediaCodec.createEncoderByType )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 保证Android MediaCodec API支持哪些视频编码器? - Which video encoders are guaranteed to be supported by android MediaCodec API? MediaCodec的多个实例在Android中用作视频编码器 - Multiple instances of MediaCodec used as video encoder in Android 为什么Android NDK附带有多个libgcc.a,应该使用哪个libgcc.a进行链接? - Why are there multiple libgcc.a shipped with android NDK, which one should be used to link with? 让QualComm编码器通过MediaCodec API工作 - Getting QualComm encoders to work via MediaCodec API Android MediaCodec NDK 未使用 SPS/PPS VUI - SPS/PPS VUI Not Used By Android MediaCodec NDK Listview中的Listview-&gt;应该使用哪个适配器(Android) - Listview in Listview -> which adapter should be used (Android) Appdynamics vs Crittercism应该用于iOS / Android应用的崩溃日志和健康检查 - Appdynamics vs Crittercism which one should be used for crash logs and health check for iOS/Android apps Android应将哪个Intent标志用于ActivityGroup? - Android which Intent Flag should be used for ActivityGroup? 应该使用哪种Linux来构建Android - Which Linux should be used to build Android 在我的Android设备上由多个编码器支持的Mime类型视频/ avc - Mime type video/avc supported by multiple encoders on my Android device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM