Created
November 4, 2017 20:34
-
-
Save sushihangover/e30e516a0081ea9abe493c6d07dfd24a to your computer and use it in GitHub Desktop.
AVAssetExportSession / Log all combinations of an asset with an AVFoundation file type (UTI) and an export preset if it is a valid combination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//var bundleUrl = NSBundle.MainBundle.GetUrlForResource("anemone_coralmorphologic", "mp4"); | |
var bundleUrl = NSBundle.MainBundle.GetUrlForResource("addf8-Alaw-GW", "wav"); | |
var asset = AVAsset.FromUrl(bundleUrl); | |
foreach (var fileType in Enum.GetValues(typeof(AVFileTypes))) | |
{ | |
foreach (var preset in AVAssetExportSession.AllExportPresets) | |
{ | |
var UTIConstant = ((AVFileTypes)(Enum.Parse(typeof(AVFileTypes), fileType.ToString()))).GetConstant(); | |
var ok = await AVAssetExportSession.DetermineCompatibilityOfExportPresetAsync( | |
preset, | |
asset, | |
UTIConstant | |
); | |
Console.WriteLine($"{ok.ToString().PadLeft(5)}: {fileType.ToString().PadLeft(20)} : {UTIConstant} : {preset}"); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/a/47115210/4984832