android 编码帧率,android – 如何在使用MediaRecorder类时更改帧率

我尝试使用MediaRecorder Class录制视频.

但是我发现我没有降低视频流的帧速率.

我使用H.264作为我的视频编码器和AAC作为我的音频编码器(是的,它在API LEVEL 10及以上版本,AKA Android 2.3.3中受支持)

主要来源如下.

recorder = new MediaRecorder();

recorder.setPreviewDisplay(surfaceHolder.getSurface());

recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);

recorder.setAudioSource(MediaRecorder.AudioSource.MIC);

//set the Output Format

recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);

//set the Video Size

recorder.setVideoSize(176,144);

//set the Frame rate

recorder.setVideoFrameRate(15);

//Set the Video Encoder

recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);

//Set the Audio Encoder

recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);

recorder.setOutputFile(myRecAudioFile.getAbsolutePath());

recorder.prepare();

recorder.start();

但是我收到了调试信息:

03-22 22:39:41.120: WARN/StagefrightRecorder(662): Intended video encoding frame rate (15 fps) is too small and will be set to (27 fps)

很奇怪,我也收到一条错误消息:

03-22 22:39:41.380: ERROR/VENC_ENC(662): Bitrate 192000

最后,我得到了一个mp4文件,其帧速率接近28fps.

我也尝试使用最低的CamcorderProfile

recorder = new MediaRecorder();

recorder.setPreviewDisplay(surfaceHolder.getSurface());

recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);

recorder.setAudioSource(MediaRecorder.AudioSource.MIC);

//replacement

CamcorderProfile cpLow = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);

recorder.setProfile(cpLow);

recorder.setOutputFile(myRecAudioFile.getAbsolutePath());

recorder.prepare();

recorder.start();

并评论记录器的详细配置.

正如Pro Android Media所说的那样,我会得到15fps的视频文件.但是,我再次获得了大约27fps的视频文件.

那么如何降低视频的帧速率呢?我正在构建一个实时系统,因此降低比特率对我来说非常重要.

感谢您的时间!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值