是否可以在通过 android 上传之前降低视频文件的质量?

我目前正在尝试在上传到在线云数据库之前降低视频和音频的质量。下面是我用来录制视频的代码。


recordVideoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);

将 EXTRA_VIDEO_QUALITY 中的 0 更改为 1 将提高质量,反之亦然,但如果是 30 秒或更长时间的视频,文件仍然太大而无法下载。


private void RecordVideoMode() {

        Intent recordVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);

        // Ensure that there's a camera activity to handle the intent

        if (recordVideoIntent.resolveActivity(getPackageManager()) != null) {

            videoFile = createVideoFile();


            // Continue only if the File was successfully created

            if (videoFile != null) {

                videoURI = FileProvider.getUriForFile(this,

                        "com.example.android.fileprovider",

                        videoFile);

                recordVideoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);

                recordVideoIntent.putExtra(MediaStore.EXTRA_OUTPUT, videoURI);

                startActivityForResult(recordVideoIntent, REQUEST_VIDEO_CAPTURE);

            }

        }

    }

很感谢任何形式的帮助!


沧海一幻觉
浏览 111回答 1
1回答

一只甜甜圈

您可以使用这两种方法:将其编码为较低的比特率和/或较低的分辨率。看看这里:是否可以在 Android 上压缩视频?尝试压缩/压缩它。看看这里:http://www.jondev.net/articles/Zipping_Files_with_Android_%28Programmatically%29
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java