Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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
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,
"Test-Video-" + 100 + "-" + Guid.NewGuid().ToString() + "-Adaptive-Bitrate-MP4",
Console.WriteLine("Submitting transcoding job...");
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());
Console.WriteLine("Transcoding job end.");
IAsset outputAsset = job.OutputMediaAssets[0];
return outputAsset;

This comment has been minimized.

Copy link
Owner Author

itorian commented Apr 19, 2016

Here is the error I was getting on Azure portal:

error in transcoding task

Here is the error details in output after using above code snippet:


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.