1

I have done a custom camera application in Xamarin.Forms, it takes the videos either with a very low resolution or with a very high resolution.

Plugin.Media.Abstraction.VideoQuality.Medium
Plugin.Media.Abstraction.VideoQuality.Low

Medium captures video with 1080P and Low with 144P. I want to have video with 480P or 720P. How can I change that.

Thanks in advance

Smile Azeez
  • 147
  • 4
  • 13

1 Answers1

3

Looking at the code of this nuget, I see that's it's using Android's EXTRA_VIDEO_QUALITY to control the quality of the video. As you can see in the documentation, it allows only values 1 and 0. The nuget uses this logic to determine the value of EXTRA_VIDEO_QUALITY:

private static int GetVideoQuality(VideoQuality videoQuality)
{
    switch (videoQuality)
    {
        case VideoQuality.Medium:
        case VideoQuality.High:
            return 1;

        default:
            return 0;
    }
}

so it's not really possible to easily change the quality to other values. What about resizing the video yourself? Maybe this will start you on this: Video compression on android using new MediaCodec Library

If you want to change quality of saved photos, you can do it with this property:

var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
{
    CompressionQuality = 92
});

where 0 is max compression and 100 (max) is no compression, it's supported only by iOS and UWP in this plugin.

Here's the documentation I've used: https://github.com/jamesmontemagno/MediaPlugin

Michał Żołnieruk
  • 2,095
  • 12
  • 20