Android - is there a way to define the video resolution when taking video from application?

android, resolution, video-capture

Solution

There are three things you can control to manage the resulting file size when recording video. All three are available as methods in `MediaRecorder` class:

Frame size (width x height). Use method `setVideoSize(int width, int height)`. The smaller the frame size, the smaller the video file.

Encoding bit rate - this controls compression quality of each frame. Use method `setVideoEncodingBitRate (int bitRate)`. Lower bit rate results in higher compression, which in turn leads to lower quality and lower video file size. This is only available from API level 8 and above.

Video "speed" - how many frames per second are captured. Use `setVideoFrameRate (int rate)` method. The lower the rate, the fewer frames you'll be capturing - resulting in a smaller video file size. This is only available from API level 11 and above. Remember though that for a smooth video you need at least 24 frames per second.

Have a look at the documentation for MediaRecorder` for more information.

Problem

I am not familiar with android programming, I wish to know if there is a way to set the video resolution when it is filmed inside an android application ? Or, is there a way to reduce the resolution later. We need to reduce the file size of the video that we capture. Thanks Shani

Original source

Related problems