1

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();
CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440

1 Answers1

0

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.

Eddy Talvala
  • 17,243
  • 2
  • 42
  • 47
  • Hi, this is exactly what I am trying to avoid. As we want all videos recorded across the board to be about the same size hence setting all the bitrates manually. I will look into the MediaCodecInfo, thanks. – YRfree Developers Nov 09 '16 at 09:40