Android的 - 有没有办法从申请采取视频时定义视频分辨率?视频、没有办法、分辨率、定义

2023-09-05 02:46:24 作者:梦呓

我不熟悉与Android编程,

I am not familiar with android programming,

我想知道是否有一种方法来设置视频分辨率当拍摄一个Android应用程序中?

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.

感谢

沙尼

推荐答案

有三件事情你可以控制录制视频时管理生成的文件大小。这三种方法都可以作为类 MediaRecorder方法:

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:

框尺寸(宽x高)。使用方法 setVideoSize(INT宽度,高度INT)。较小的帧大小,较小的视频文件

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

编码比特率 - 这种控制COM pression每一帧的质量。使用方法 setVideoEncodingBitRate(INT比特率)。较低的比特率导致较高的COM pression,这反过来又导致较低质量和较低的视频文件的大小。这只能从API级别8及以上。

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.

视频速度 - 如何每秒多少帧被捕获。使用 setVideoFrameRate(INT率)方法。导致较小的视频文件大小 - 速度,更少的帧,你会捕捉下。这只能从API级别11以上。但请记住,对于你需要至少每秒24帧流畅的视频。

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.

看一看为MediaRecorder`的文档了解更多信息。

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