How can i record low resolution videos in andorid to upload to server why because recorded videos in android is havin 3 MB in size even of 3 sec video.i have searched all way please help me out
If you're using the MediaStore.ACTION_VIDEO_CAPTURE intent, you can adjust the quality by setting the MediaStore.EXTRA_VIDEO_QUALITY extra to 0 for a lower quality video, if you're accessing the camera API directly, then you'd have to adjust the camera profile via MediaRecorder.setProfile()
. Here's an example from the Android developer site .
As per the MediaStore docs, ACTION_VIDEO_CAPTURE
is Standard Intent action that can be sent to have the camera application capture a video and return it.
The caller may pass in an extra EXTRA_VIDEO_QUALITY
to control the video quality.
The name of the Intent-extra used to control the quality of a recorded video. This is an integer property. Currently value 0 means low quality, suitable for MMS messages, and value 1 means high quality. In the future other quality levels may be added.
So you can use it like below,
Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra(android.provider.MediaStore.EXTRA_VIDEO_QUALITY, 0);
startActivityForResult(intent, REQUEST_VIDEO_CAPTURED);
This will record the video in low quality compare to the normal intent. But still in some of the cases like recording more time will also may cause the video size increase.
So you can also look for EXTRA_SIZE_LIMIT and EXTRA_DURATION_LIMIT to set the Specify the maximum allowed size and Specify the maximum allowed recording duration in seconds.
In other hand,If these things not worked or suitable you can record the video normally and compress the video while uploading into the server. It will reduce the size of the video.
Look this sample for video compression.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With