Front Camera Video Capturing Distortion - Android

送分小仙女□ 提交于 2019-12-06 07:40:01
BASEER ULHASSAN

I have searched a lot and eventually found the solution as below.

The BitRate,setEncodingBitRate,setVideoFrameRate,setVideoSize functions can have parameters according to your or user-end devices. I have used constant values working fine for me. Set them generic accordingly. Also, Remember that camera resolution is also set LOW for Front Cameras.

    mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
    mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
    mediaRecorder.setVideoEncodingBitRate(512* 1000);
    mediaRecorder.setVideoFrameRate(15);
    mediaRecorder.setVideoSize(640,480);
    mediaRecorder.setVideoSize( 200, 200 );
    mediaRecorder.setOutputFile("/sdcard/myvideo.mp4");
    mediaRecorder.setMaxDuration(600000); // Set max duration 60 sec.
    mediaRecorder.setMaxFileSize(50000000); // Set max file size 50M

`Attaching Links which helped me to come to this solution. Blurr/Distorted video Error Insight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!