L
L
loly2016-06-13 13:47:19
Android
loly, 2016-06-13 13:47:19

How to programmatically change the quality of the resulting video in android to medium?

According to this page https://developer.android.com/guide/topics/media/c... I can send "to the camera" some instructions like:

MediaStore.EXTRA_OUTPUT - This setting requires a Uri specifying a path and file name where you'd like to save the video. This setting is optional but strongly recommended. If you do not specify this value, the Camera application saves the requested video in the default location with a default name, specified in the returned intent's Intent.getData() field.
MediaStore.EXTRA_VIDEO_QUALITY - This value can be 0 for lowest quality and smallest file size or 1 for highest quality and larger file size.
MediaStore.EXTRA_DURATION_LIMIT - Set this value to limit the length, in seconds, of the video being captured.
MediaStore.EXTRA_SIZE_LIMIT - Set this value to limit the file size, in bytes, of the video being captured.

I tried using 1 of the options (MediaStore.EXTRA_VIDEO_QUALITY):
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
        startActivityForResult(intent, REQUEST_VIDEO_CAPTURE);

and this is a very strange setting.
First, it not only changes the resolution to the minimum, but also changes the resulting ratio to 4:3.
Secondly, the resulting 15-second image weighs ~300-500 kb, while its completely similar counterpart without this parameter is 30 MB. This is an obvious overkill.
I don't need 30 MB of video (since it has yet to be sent over the network, most likely through a mobile connection), but even 0.3 MB is a clear overkill. Parameter 0.5 is perceived by the camera as 0 (and such a possibility is not described.
PS Yes, the video is already limited in time - 15 seconds.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Malinin, 2016-07-26
@bozhan

To record video from the camera, MediaRecorder
is used. According to your link, this is described in the Capturing videos section.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question