Android - is there a way to define the video resol

2019-01-26 19:24发布

问题:

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

回答1:

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:

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

  2. 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.

  3. 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.