-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于Android MediaCodec硬编码16位对齐的问题 #29
Comments
对齐之后,有没有在多出来的边缘补齐像素点?留白的话就会出现绿边了 |
@ragnraok 感谢回复! {mime=video/raw, crop-top=0, crop-right=719, slice-height=1280, color-format=2141391876, height=1280, width=720, what=1869968451, crop-bottom=1279, crop-left=0, stride=768} 因此,得到的对齐宽高应该是768x1280,而不是720x1280。我按照768x1280重新编码,视频图像正确,但是右边出现绿边,如果用720x1280编码,结果是花屏。说明我之前的对齐方式有问题,但是在其他设备上面遇到一个新的问题:这种方式拿到的分辨率有可能仍然不是16位对齐的,所以某些奇怪的机型又有问题,我又不得不再增加一层判断(PS:做Android遇到设备兼容性问题真特么累)。 最后:请教下关于绿边填充像素的实现原理,我的流程是:解码成YUV数据,然后重新编码。这个过程中如何实现补齐像素,烦请指教,多谢! |
建议还是不要使用这个stride来作为宽高的标准,而是以你设定的宽高为基准,寻找最近的16位对齐的整数,然后在多出来的边缘补齐像素点之后,再送入编码器 |
woca 这个问题,怎么来解决呢。贼麻烦 |
前段时间我也遇到这个问题了,参考:https://stackoverflow.com/questions/28291204/something-about-stagefright-codec-input-format-in-android 解决了。
但现在遇到一个新问题:视频能正常编码出来,但是部分手机在视频右侧或底部出现一条绿纹,应该就是对齐增加的几个像素导致,不知道如何解决。
不知道是不是对齐的方式有问题,我的方式:
if (w % 16 > 0) {
w = (w / 16) * 16 + 16;
}
if (h % 16 > 0) {
h = (h / 16) * 16 + 16;
}
有遇到相同的情况吗?
The text was updated successfully, but these errors were encountered: