我正在尝试使用MediaRecorder.setVideoEncodingBitRate(int)更改android上视频录制的编码比特率。
我查看了android文档,它声明了这个方法来设置/更改比特率,但是当我尝试使用这个方法时,我得到的setVideoEncodingBitrRate(int)没有在packageMediaRecorder中定义。
为什么会这样?

最佳答案

我建议你检查一下你使用的是哪个api版本
setVideoEncodingBitRate()只需使用API V8或Android 2.1即可
如果您使用的版本低于此版本,则它将不可用:d
你也可以这样用

webCamRecorder = new MediaRecorder();
if (target_holder == null)
    return;
webCamRecorder.setPreviewDisplay(target_holder.getSurface());
webCamRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
webCamRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
webCamRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
webCamRecorder.setAudioEncodingBitRate(196608);
webCamRecorder.setVideoSize(640, 480);
webCamRecorder.setVideoFrameRate(30);
webCamRecorder.setVideoEncodingBitRate(15000000);
webCamRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
webCamRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
webCamRecorder.setOutputFile("your location to save");

08-04 00:50