有机压缩器压缩后没有声音和质量不良
我一直在压缩图像没有任何问题。最近,我的应用需要添加视频压缩功能。同样,有机压缩器可以完成这项工作,但由于某种原因,输出文件中没有音频。
我在运行中使用代码
private void compressVideo() {
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath());
new CompressVideo().execute("false",uri.toString(),file.getPath());
// Uri muri = Uri.parse(uri.toString());
}
@SuppressLint("StaticFieldLeak")
private class CompressVideo extends AsyncTask<String,String,String> {
@Override
protected String doInBackground(String... strings) {
String videoPath = null;
try {
Uri mUri = Uri.parse(strings[1]);
videoPath = SiliCompressor.with(PostReelActivity.this).compressVideo(mUri,strings[2]);
} catch (URISyntaxException e) {
e.printStackTrace();
}
return videoPath;
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
File file = new File(s);
Uri videoUri = Uri.fromFile(file);
uploadVideo(videoUri);
}
}
I have been compressing Images without any problems. Recently my app required video compress functionality to be added. Again, Silicompressor does the job but for some reason there is no audio in output file.
I am using code inside Runnable
private void compressVideo() {
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath());
new CompressVideo().execute("false",uri.toString(),file.getPath());
// Uri muri = Uri.parse(uri.toString());
}
@SuppressLint("StaticFieldLeak")
private class CompressVideo extends AsyncTask<String,String,String> {
@Override
protected String doInBackground(String... strings) {
String videoPath = null;
try {
Uri mUri = Uri.parse(strings[1]);
videoPath = SiliCompressor.with(PostReelActivity.this).compressVideo(mUri,strings[2]);
} catch (URISyntaxException e) {
e.printStackTrace();
}
return videoPath;
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
File file = new File(s);
Uri videoUri = Uri.fromFile(file);
uploadVideo(videoUri);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论