0

I am currently trying to reduce the quality of videos and audio before uploading to and online cloud database. Below is the code I have been using to record videos.

recordVideoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);

Changing the 0 to 1 in EXTRA_VIDEO_QUALITY will increase the quality and vice versa, but the file is still too large to download if it a 30 second or more video.

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);
            }
        }
    }

Any help is very much appreciated!

1 Answers1

0

You can go with this two methods :

Encode it to a lower bit rate and/or lower resolution. Have a look here:

Is it possible to compress video on Android?

Try to zip/compress it. Have a look here:

http://www.jondev.net/articles/Zipping_Files_with_Android_%28Programmatically%29

Anupam
  • 2,845
  • 2
  • 16
  • 30