首页 > 解决方案 > Android MediaRecorder CaptureReate 和 VideoFrameRate 没有效果

问题描述

我正在使用 MediaRecorder 记录设备的屏幕。我希望能够控制捕获的视频的帧速率。

我尝试设置 MediaRecorder 的 Capture Rate 和 VideoFrameRate 属性,但它们似乎没有效果:

this.mRecorder.setCaptureRate(this.fps);
this.mRecorder.setVideoFrameRate(this.fps);

根据文档(s​​etCaptureRatesetVideoFrameRate),我正在调用setCaptureRatesetVideoFrameRate 设置格式和视频源之后,调用之前prepare

this.mRecorder = new MediaRecorder();
this.mRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
this.mRecorder.setVideoSource(2);
this.mRecorder.setOutputFormat(2);
this.mRecorder.setOutputFile(this.mFilePath);
this.mRecorder.setVideoSize(screenWidth, screenHeight);
this.mRecorder.setVideoEncoder(2);
this.mRecorder.setAudioEncoder(2);
this.mRecorder.setVideoEncodingBitRate(this.mBitRate);
this.mRecorder.setCaptureRate(this.fps);
this.mRecorder.setVideoFrameRate(this.fps);
this.mRecorder.prepare();

我已经检查过,并this.fps设置为 5,所以它不像其他一些不正确的值......并且文档说:

fps可以根据需要降低

有谁知道如何设置FPS?

标签: androidmediarecorder

解决方案


推荐阅读