I'm working with the MediaRecorder API for a while, I thought all problems are behind me but I guess I was wrong.
I'm using the MediaRecorder API for recording video to a file. When I use the setProfile with high quality I get good quality but when I try to set the parameters manually (as in the code below) the quality is bad (since for some reason the bitrate is cropped). I want to get 720p with 1fps.
I keep getting the following warning: WARN/AuthorDriver(268): Video encoding bit rate is set to 480000 bps
The code I'm running:
m_MediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
m_MediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
m_MediaRecorder.setVideoSize(1280, 720);
m_MediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
m_MediaRecorder.setVideoFrameRate(1);
m_MediaRecorder.setVideoEncodingBitRate(8000000);
Any idea? Thanks a lot.
Found the solution...very weird however. Setting the bit-rate before setting the compression type somehow solved the problem. The only question is whether it is a bug in google's code or something else that I don't understand.
Original:
m_MediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
m_MediaRecorder.setVideoFrameRate(1);
m_MediaRecorder.setVideoEncodingBitRate(8000000);
Solution:
m_MediaRecorder.setVideoEncodingBitRate(8000000);
m_MediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
m_MediaRecorder.setVideoFrameRate(1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With