Skip to content
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

压缩无法播放 #33

Open
combing520 opened this issue Jul 5, 2019 · 7 comments
Open

压缩无法播放 #33

combing520 opened this issue Jul 5, 2019 · 7 comments

Comments

@combing520
Copy link

下载 demo ;使用 videoCompress.compressVideoHigh()方法;视频只有140b左右;无法播放;
VIVO x9 ; 红米 4X ;

@ZDZN
Copy link

ZDZN commented Aug 12, 2019

我也遇到这个问题了,问题主要是压缩参数,目标视频的宽高和码率,调整之后就可以了,但不清楚调整有没有什么规则

@weixiao666
Copy link

@ZDZN 你是怎么设置的啊,能发一下吗贴一下代码吗

@biansemao
Copy link

看下是不是你的视频width,height属性,是不是有问题?
MediaFormat里面的width,height属性,只接受2的倍数的。不然就会报Android android.media.MediaCodec$CodecException: Error 0xfffffc0e 错误

解决方法:
在MediaFormat outputFormat = MediaFormat.createVideoFormat(MIME_TYPE, resultWidth, resultHeight);之前做判断,宽高改为2的倍数。
改为
if ((resultWidth & 1) == 1) {
resultWidth--;
}
if ((resultHeight & 1) == 1) {
resultHeight--;
}
MediaFormat outputFormat = MediaFormat.createVideoFormat(MIME_TYPE, resultWidth, resultHeight);

@mingxin-yang
Copy link

2的倍数也不行 @biansemao

@baiyang666
Copy link

@biansemao我也遇到了,不是所有手机都出现。压缩后140b

@RamboMing
Copy link

华为手Mate30 也是同样问题

@Hn1993
Copy link

Hn1993 commented Jan 22, 2021

遇到同样的问题 压缩之后无法播放

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants