有机压缩器压缩后没有声音和质量不良

发布于 2025-01-18 19:05:48 字数 1059 浏览 3 评论 0原文

我一直在压缩图像没有任何问题。最近,我的应用需要添加视频压缩功能。同样,有机压缩器可以完成这项工作,但由于某种原因,输出文件中没有音频。

我在运行中使用代码

 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文