当有媒体codeC和MTK codeC编码选择H264简介 [英] Select H264 Profile when encoding with MediaCodec and MTK Codec

查看:2786
本文介绍了当有媒体codeC和MTK codeC编码选择H264简介的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Android应用程序,连接codeS视频转换为H264。在所有previously尝试Android设备此连接codeS到基准轮廓这正是我所需要的。

We have an Android app that encodes video into H264. On all previously tried Android devices this encodes to Baseline profile which is what I need.

在联想瑜伽10 codeC是OMX.MTK.VIDEO.EN codeR.AVC。这间设codeS视频为High Profile的这给问题的接收设备。

On the Lenovo Yoga 10 the codec is OMX.MTK.VIDEO.ENCODER.AVC. This encodes the video as High Profile which gives a problem for the receiving device.

我使用的媒体codeC。似乎有没有办法设置配置文件中使用。

I am using MediaCodec. There seems to be no way to set the profile to be used.

有没有办法这样做的?在codeC并声称支持Baseline Profile的,但给没办法使用它。是否有一个codeC的具体参数吗?

Is there any way of doing this ? The codec does claim to support Baseline profile but gives no way of using it. Is there a codec specific parameter for this?

推荐答案

有什么你可以尝试是将项添加简介您MediaFormat,与<$值C $ C> 1 ( OMX_VIDEO_AVCProfileBaseline )。如果你这样做,你可能还需要添加键水平与电平值相匹配的分辨率,以及(从OMX AVC级别的常量的值)。

What you could try is to add the key profile to your MediaFormat, with a value of 1 (OMX_VIDEO_AVCProfileBaseline). If you do this, you probably also need to add the key level with a level value matching your resolution as well (with a value from the OMX AVC level constants).

我不知道,如果这codeC居然荣誉的请求的值,虽然,但它可能是值得一试。

I'm not sure if this codec actually honors the requested value though, but it might be worth a try.

见<一个的 setupAVCEn coderParameters 功能href="https://android.googlesource.com/platform/frameworks/av/+/6ade04174/media/libstagefright/A$c$cc.cpp" rel="nofollow">https://android.googlesource.com/platform/frameworks/av/+/6ade04174/media/libstagefright/A$c$cc.cpp对安装过程的一个例子。它看起来对简介输入参数(这是从您所提供的MediaFormat复制),但如果这是present您还需要提供关键一个水平参数,什么级别的使用取决于你的决心。请参阅<一href="https://android.googlesource.com/platform/frameworks/native/+/cde4b13a/include/media/openmax/OMX_Video.h" rel="nofollow">https://android.googlesource.com/platform/frameworks/native/+/cde4b13a/include/media/openmax/OMX_Video.h恒定值,可以使用的参数。

See the setupAVCEncoderParameters function in https://android.googlesource.com/platform/frameworks/av/+/6ade04174/media/libstagefright/ACodec.cpp for an example on the setup procedure. It looks for the profile key in the input parameters (which are copied from the MediaFormat that you've provided), but if this is present you also need to provide a level parameter, and what level to use depends on your resolution. See https://android.googlesource.com/platform/frameworks/native/+/cde4b13a/include/media/openmax/OMX_Video.h for constant values you can use for the parameters.

不过检查的档次和级别的参数之后,它似乎也覆盖配置文件基线不管什么设置。因此,无论这些行已经从设备被拆除,或EN codeR完全无视 h264type.eProfile 字段。

But after checking for the profile and level parameters, it also seems to override the profile to baseline regardless of what was set. So either these lines have been removed from your device, or the encoder disregards the h264type.eProfile field altogether.

如果有人得到了一个源代码树更接近实际什么用的设备,这将是更好的检查这一点。

If someone has got a source tree closer to what actually is used on the devices, it would be even better to inspect that.

至于如何挑选一个合适的水平,为您解决的例子,在的 x264_validate_levels =htt​​p://git.videolan.org /?p=x264.git;a=blob;f=en$c$cr/set.c;h=1a40b71284相对=nofollow> http://git.videolan.org/?p=x264.git ; A =斑点; F = EN codeR / set.c; H = 1a40b71284 (但传递给MediaFormat水平必须是前$使用 OMX_VIDEO_AVCLEVELTYPE

常量)。

As an example on how to pick a suitable level for your resolution, have a look at x264_validate_levels in http://git.videolan.org/?p=x264.git;a=blob;f=encoder/set.c;h=1a40b71284 (but the level passed to MediaFormat needs to be expressed using the OMX_VIDEO_AVCLEVELTYPE constants).

不知道这什么帮助,但它至少值得一试。

Not sure if anything of this helps, but it's at least worth a try.

这篇关于当有媒体codeC和MTK codeC编码选择H264简介的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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