Nexus 7 2013 mediacodec video encoder garbled output

不羁的心 提交于 2020-01-11 06:57:08

问题


I'm working on an app which encodes a movie using h.264 encoder to gallery and other targets. This app supports variable aspect ratios at output (1:1, 2:3, 3:2, 16:9, 3:4, 4:3). I'm using surface inputs for input/output from the 4.3 API.

The app works ok on many devices (tested on S3, Motorola G, Nexus 7 2012, Motorola X), however, I've hit a wall when running it on Nexus 7 2013.

Basically, some output resolutions work, some do not. 3:4 (720x960), 2:3 (720x1080) and 16:9 (1280x720) work as intended, but the rest (1:1 (960x960), 3:2 (1080x720) and 4:3 (960x720)) produce an output like this:

http://imageshack.com/a/img811/7984/dtgh.png

My guess is that there is some value hard coded in the encoder which treats its input surface as having a different width than it actually has - the pixel lines seem to "not line up correctly". However, I am at a loss at what can cause this and how to work around it.

There are no errors in the log and the video encoder codec outputs in the log the correct surface width and height when outputing the media format.

update: seems there are no issues when encoding with 360, 720 or 1280 width, with height having no impact. I haven't found any other widths below 1280 that work.

update2: seems there are more widths that work: 180, 240, 640, 700. Couldn't find any correlation between them.

来源:https://stackoverflow.com/questions/22579865/nexus-7-2013-mediacodec-video-encoder-garbled-output

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