通过 MediaCodec API 使 QualComm 编码器工作 [英] Getting QualComm encoders to work via MediaCodec API

查看:44
本文介绍了通过 MediaCodec API 使 QualComm 编码器工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Android MediaCodec API 对 NV12 流进行硬件编码 (avc).

I am trying to do hardware encoding (avc) of NV12 stream using Android MediaCodec API.

使用 OMX.qcom.video.encoder.avc 时,分辨率 1280x720 和 640x480 工作正常,而其他分辨率(即 640x360、320x240、800x480)产生色度分量似乎发生偏移的输出(请参阅 快照).

When using OMX.qcom.video.encoder.avc, resolutions 1280x720 and 640x480 work fine, while the others (i.e. 640x360, 320x240, 800x480) produce output where chroma component seems shifted (please see snapshot).

我已通过将输入图像保存到 jpeg 文件来仔细检查输入图像是否正确.此问题仅出现在 QualComm 设备(即三星 Galaxy S4)上.

I have double-checked that the input image is correct by saving it to a jpeg file. This problem only occurs on QualComm devices (i.e. Samsung Galaxy S4).

有人能正常使用吗?需要任何额外的设置/怪癖吗?

Anyone has this working properly? Any additional setup / quirks necessary?

推荐答案

Decoder(MediaCodec) 有它的 MediaFormat,可以使用 getOutputFormat.返回的实例可以打印到日志中.在那里你可以看到一些有用的信息.例如,在您的情况下,像slice-height"这样的值可能很有用.我怀疑它等于 1280x720 和 640x480 的高度,而其他分辨率则不同.可能你应该使用这个值来获得色度偏移.

Decoder(MediaCodec) has its MediaFormat, it can be received using getOutputFormat. Returned instance can be printed to log. And there you can see some useful information. For example in your case value like "slice-height" could be useful. I suspect that it is equal to height for 1280x720 and 640x480 and differs for other resolutions. Probably you should use this value to get chroma offset.

这篇关于通过 MediaCodec API 使 QualComm 编码器工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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