androidxamarinrecordmediarecorderbitrate

Determine maximum bitrate supported to record videos


Currently my bitrate is hardcoded to ~2mb/s. I want to set it to the maximum bitrate supported by the device, but I'm not sure how to check it.

Here's part of my code if it helps:

  MyRecorder = new MediaRecorder();

    // ...
        MyRecorder.SetVideoEncoder(VideoEncoder.H264);
        MyRecorder.SetVideoEncodingBitRate("2000000"); 
    // ...

How do I check what is the maximum supported rate or what is the recommended bitrate for recording High Quality videos?


Solution

  • Maybe you could try this :

    MediaRecorder mediaRecorder = new MediaRecorder();
    CamcorderProfile camcorderProfile = CamcorderProfile.Get(CamcorderQuality.High);//Quality level corresponding to the highest available resolution.
    var targetVideoBitRate = camcorderProfile.VideoBitRate;
    mediaRecorder.SetAudioEncodingBitRate(targetVideoBitRate);
    

    the more information you could refer to CamcorderProfile