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

假装没事ソ 提交于 2019-11-29 08:03:41

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!