如何设置MediaRecorder,以获得最佳的视频质量的影响?如何设置、质量、视频、MediaRecorder

2023-09-06 15:27:56 作者:“咬”字拆开念

大家好可有人告诉我,我应该如何才能获得最佳的视频录制效果可以通过编码不考虑手机的物理限制设置在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?

有人可以帮助我在这个问题上,因为我是比较新的Andr​​oid中/ java编程..谢谢:) 如果你们当中有些人可能会猜测不清参数实际上,我设置一些使用preferences参数的。什么是参数我想念这可能有助于提高视频编码过程如:帧率

Can someone help me on this matter because i'm rather new in android/java programming.. Thanks :) 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 eg: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);

请注意,你不能有两个选项在一起,你会得到错误或prepare将无法正常工作

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

由于并非所有的Andr​​oid 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.

 
精彩推荐
图片推荐