Last active
April 19, 2016 06:12
-
-
Save itorian/4ac5fa723b3d5267258450a2c1a00294 to your computer and use it in GitHub Desktop.
In case you are facing error in scheduled transcoding task and you would like to know details of the error, you can use below code snippet. More details here http://www.itorian.com/2016/04/azure-media-services-transcoding.html
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
static public IAsset EncodeToAdaptiveBitrateMP4s(IAsset asset, AssetCreationOptions options) | |
{ | |
// Default preset settings | |
//IJob job = _context.Jobs.CreateWithSingleTask(MediaProcessorNames.AzureMediaEncoder, | |
// MediaEncoderTaskPresetStrings.H264AdaptiveBitrateMP4Set720p, | |
// asset, | |
// "Test-Video-" + 100 + "-" + Guid.NewGuid().ToString() + "-Adaptive-Bitrate-MP4", | |
// AssetCreationOptions.None); | |
// Custom preset settings | |
string configuration = File.ReadAllText(Path.Combine(_presetFiles, @"H264MultipleBitrateCustom720p.xml")); | |
IJob job = _context.Jobs.CreateWithSingleTask(MediaProcessorNames.AzureMediaEncoder, | |
configuration, | |
asset, | |
"Test-Video-" + 100 + "-" + Guid.NewGuid().ToString() + "-Adaptive-Bitrate-MP4", | |
AssetCreationOptions.None); | |
Console.WriteLine("Submitting transcoding job..."); | |
job.Submit(); | |
job = job.StartExecutionProgressTask( | |
j => | |
{ | |
Console.WriteLine("Job state: {0}", j.State); | |
// Error handling | |
if(j.State == JobState.Error) | |
{ | |
foreach (var task in job.Tasks) | |
{ | |
if (task.ErrorDetails != null) | |
{ | |
foreach (var errordetail in task.ErrorDetails) | |
{ | |
Console.WriteLine("Error Message:" + errordetail.Message); | |
Console.WriteLine("Error Code:" + errordetail.Code); | |
} | |
} | |
} | |
} | |
Console.WriteLine("Job progress: {0:0.##}%", j.GetOverallProgress()); | |
}, | |
CancellationToken.None).Result; | |
Console.WriteLine("Transcoding job end."); | |
IAsset outputAsset = job.OutputMediaAssets[0]; | |
return outputAsset; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is the error I was getting on Azure portal:
Here is the error details in output after using above code snippet: