安卓:修改录制的视频质量质量、视频

2023-09-08 00:14:52 作者:深沉

我用MediaRecorder录制视频。目前尚不清楚对我来说,我应该使用来改变图像的质量,假设视频的大小保持恒定什么参数。例如,我想总是创建一个640x480的MP4视频。我可以调整哪些参数来增加或减少的质量呢?

I'm using MediaRecorder to record a video. It isn't clear to me what parameters I should be using to change the quality of the image, assuming the size of the video remains constant. For example, I want to always create a 640x480 mp4 video. What parameters can I adjust to increase or decrease the quality?

推荐答案

您可以尝试使用

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);

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

有关设置高品质,低质量参数见这里

For setting high quality and low quality parameter see here