Hello,
Welcome to our Microsoft Q&A platform!
You should implement this on each platform.
In android, you can refer sample: https://github.com/leye0/XamarinAndroidFFmpeg
And there is a better library here: https://github.com/natario1/Transcoder .
In IOS, try the following 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 );
});
Best Regards,
Jessie Zhang
---
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.