如何设置 MediaRecorder 以获得最佳的视频质量效果? [英] How to set the MediaRecorder to get the best video quality effect?

查看:35
本文介绍了如何设置 MediaRecorder 以获得最佳的视频质量效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我如何在MediaRecorder中设置参数,以便在不考虑手机物理限制的情况下通过编码获得最佳视频录制效果?还是我对MediaRecorder的编码造成的视图小失真有什么影响?

Guys can someone tell me how should I set the parameters in the MediaRecorder in order to get the best video recording effect possible through coding without considering the physical limitation of the phone? Or is there any effect of the view small distortion caused by my coding of the MediaRecorder?

如果你们中的一些人可能会猜测不清楚的参数,我实际上是在使用首选项设置一些参数.我错过了哪些可能有助于改进视频编码过程的参数,例如:帧率

If some of you might be guessing of the unclear parameters I'm actually setting some of the parameters using preferences. What are the parameters I miss which might help to improve the video encoding process Ex: framerate

推荐答案

根据 API 级别,您可能希望使用或不使用现有配置文件.

Depending on the API level you may want to use existing profiles or not.

没有个人资料:

recorder.setVideoSize(640, 480);
recorder.setVideoFrameRate(16); //might be auto-determined due to lighting
recorder.setVideoEncodingBitRate(3000000);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);// MPEG_4_SP
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

或者如果您想使用现有的配置文件

Or if you want to use existing profiles

CamcorderProfile cpHigh = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
recorder.setProfile(cpHigh);

请注意,您不能同时使用这两个选项,否则会出错,否则您的准备工作将不起作用

Please note that you cannot have both options together as you will get errors or your prepare will not work

由于并非所有 Android API 和/或设备都支持相同的值,因此您必须查询每个设备的最大值或找到适用于任何地方的东西.

As not all the Android API and/or devices support the same values you will either have to query the maximum values per device or find something that works everywhere.

这篇关于如何设置 MediaRecorder 以获得最佳的视频质量效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆