Forum Xamarin Xamarin.Forms

Xamarin Forms Video Compression

hi,

is there any cross platform plugins available for video compression ?

any help will be appreciated.

Posts

  • FebinDonzManGroveFebinDonzManGrove USMember ✭✭
    edited March 2016

    no cross platform solutions available i think.

    for android ,

    compress the video using ffmpeg for tamarin android https://github.com/leye0/XamarinAndroidFFmpeg

    for iOS,

    use below code

    `

                string downloadPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                string downloadFilePath = Path.Combine(downloadPath, "compressed_video.mp4");
    
                var asset = AVAsset.FromUrl( NSUrl.FromFilename( sourceFilePath ) );
    
    
                AVAssetExportSession export = new AVAssetExportSession (asset, AVAssetExportSession.PresetLowQuality );
    
                export.OutputUrl = NSUrl.FromFilename( downloadFilePath );
                export.OutputFileType = AVFileType.Mpeg4;
                export.ShouldOptimizeForNetworkUse = true;
    
                export.ExportAsynchronously(  ( ) => 
                {
    
                        if( export.Error != null )
                            System.Diagnostics.Debug.WriteLine( export.Error.LocalizedDescription );
                });`
    
  • JoseManuelOjedaJoseManuelOjeda SVMember ✭✭

    did you manage to get a good compression rate

  • FebinDonzManGroveFebinDonzManGrove USMember ✭✭

    yes, 30 MB reduced to 1 - 2 MB

  • LakshyaLakshya Member ✭✭✭
    edited April 2018

    @FebinDonzManGrove Can you share the working sample in android using crossplatform

  • oguzhanorhaanoguzhanorhaan TRMember ✭✭

    In android do you have sample?

  • anbuselvanktanbuselvankt Member ✭✭

    Hi,

    used the video compression process with the below comments, it works for up to Nougat 7.0 (API level 24), After the Android version doesn't work. Kindly help me on this.
    string[] cmds = new string[] {
    "-y",
    "-i",
    inputFilepath,
    "-strict", "experimental",
    "-vcodec", "libx264",
    "-preset", "ultrafast",
    "-crf","30", "-acodec","aac", "-ar", "44100" ,
    "-q:v", "20",
    "-vf",
    "mp=eq2=1:1.68:0.3:1.25:1:0.96:1",
    ouputFile,
    };
    Has anyone had this same problem and has a solution?

  • Ramprasad_GRamprasad_G Member ✭✭

    Can you share the sample code to reduce the video resolution so that I can upload to server. I am struggling with this. Any help is appreciated.

  • NeerajGoelNeerajGoel USMember ✭✭

    Have you found any solution for video compression ??

Sign In or Register to comment.