Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I have found that
setvideoencodingbitrate(800000)
works for most of the devices I am using but on the Samsung Galaxy S6 it seems to record at 1.3 MBs rather than 800 kbs as set.
I am assuming this is because the device doesnt support that bit rate (I could be wrong)
Is there a way of getting an android devices supported videoencoding bitrates? or at least seeing what the
MediaRecorder
has been set to after calling on prepare? I cant seem to find any kind of
mediaRecorder.getvideoencodingbitrate
call?
Code below.
mediaRecorder.setVideoEncodingBitRate(500000); //500000 works with galaxy s6
mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
mediaRecorder.setVideoFrameRate(mCaptureProfile.framesPerSecond);
// Audio Settings
mediaRecorder.setAudioChannels(mCaptureProfile.audioNumChannels);
mediaRecorder.setAudioSamplingRate(mCaptureProfile.audioSampleRate);
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
mediaRecorder.setAudioEncodingBitRate(mCaptureProfile.audioBitRate);
mediaRecorder.prepare();
In general, it's recommended you use CamcorderProfile to select the encoding settings, including bitrate, when recording video with a MediaRecorder. Select the profile with the resolution you want (for the camera you want), and then set it on the media recorder with MediaRecorder.setProfile.
This allows the device vendor to set the recommended bitrate, which may vary greatly between devices, due to different hardware encoders, supported parts of the video recording specs, and so on.
To look at the actual supported bitrates, that may be available somewhere in MediaCodecInfo.
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.