Pergunta

When attempting to upload, convert/encode and prepare a .3gp video file in Azure Media Services, we get the error File type or codec not supported. Based on this information, 3gp should be supported for import. How do I properly import 3gp and convert it to MP4?

Here's what our internal logs say:

The job stopped due to cancellation or an error.
Job ID: nb:jid:UUID:6dc360df-de54-eb45-ae0d-bdc3d2c810fe
Job Name: Encoding and Packaging for dedf426e0b5b41199e8a111f27744890
Job State: Error
Error Details:  
Task Id: nb:tid:UUID:12424cbb-0013-4685-8e6b-b224d99db186
    Error Code: UserInput
    Error Message: File type or codec not supported.

Our code:

/// <summary>
/// This method performs all processing necessary to the media in question. This method will wait while processing is completed.
/// </summary>
/// <param name="fileName">Unique file name with extension</param>
/// <returns>IsSuccess</returns>
public bool ProcessMedia(string fileName)
{
    var mediaCloud = GetCloudMediaContext();

    string assetName = GetAssetNameFromFileName(fileName);

    var asset = mediaCloud.Assets.Where(a => a.Name == assetName).SingleOrDefault();
    IJob job = mediaCloud.Jobs.Create("Encoding and Packaging for " + asset.Name);
    var encoder = GetMediaProcessor(_mediaProcessorNameMap[MediaProcessors.WindowsAzureMediaEncoder]);

    /* Firing off a chain of encoding jobs
     * 1) Original Encoding -> MP4 (Direct download stream)
     * 2) MP4 -> IIS Smooth Streaming (Microsoft Silverlight)
     * 3) IIS -> HLS (Apple and IOS) */

    //MP4
    var mp4Task = job.Tasks.AddNew(String.Format("MP4 Encoding for {0}", asset.Name), encoder, "H264 Broadband 720p", TaskOptions.None);
    mp4Task.InputAssets.Add(asset);
    var mp4Asset = mp4Task.OutputAssets.AddNew(String.Format(MP4_ASSET_NAME_FORMAT, asset.Name), AssetCreationOptions.None);

    //Generate thumbnails from MP4
    foreach (ThumbnailTypes thumbnailType in Enum.GetValues(typeof(ThumbnailTypes)))
    {
        var thumbnailTask = job.Tasks.AddNew(String.Format("Thumbnail Generation for {0}", asset.Name), encoder, 
            String.Format(TASK_THUMBNAIL_GENERATION_FORMAT, thumbnailType, ImageProcessor.ThumbnailSizes[thumbnailType].Height), 
            TaskOptions.None);
        thumbnailTask.InputAssets.Add(mp4Asset);
        var thumnailAsset = thumbnailTask.OutputAssets.AddNew(String.Format(THUMBNAIL_ASSET_NAME_FORMAT, thumbnailType, asset.Name), AssetCreationOptions.None);
    }

    //IIS
    var encodingTask = job.Tasks.AddNew(String.Format("IIS Encoding for {0}", asset.Name), encoder, "H264 Smooth Streaming 720p", TaskOptions.None);
    encodingTask.InputAssets.Add(mp4Asset);
    var ssOutput = encodingTask.OutputAssets.AddNew(String.Format(IIS_ASSET_NAME_FORMAT, asset.Name), AssetCreationOptions.None);

    //HLS
    var packager = GetMediaProcessor(_mediaProcessorNameMap[MediaProcessors.WindowsAzureMediaPackager]);
    var conversionTask = job.Tasks.AddNew(String.Format("HLS Packaging for {0}", asset.Name), packager, TASK_MSMOOTH_TO_HLS, TaskOptions.None);
    conversionTask.InputAssets.Add(ssOutput);
    conversionTask.OutputAssets.AddNew(String.Format(HLS_ASSET_NAME_FORMAT, asset.Name), AssetCreationOptions.None);

    if (job.Tasks.Count() == 0) //no processing was required
        return true;

    job.StateChanged += new EventHandler<JobStateChangedEventArgs>(StateChanged);

    job.Submit();

    // Check job execution and wait for job to finish. 
    Task progressJobTask = job.GetExecutionProgressTask(CancellationToken.None);
    progressJobTask.Wait();

    return job.State == JobState.Finished;
}
Foi útil?

Solução

You shall look at Azure Media Encoder formats and codecs, but not the Microsoft Expression Encoder supported file formats.

The above documentation states that .3GPP and .3GPP2 are supported as file formats. And the Video codecs are very limited: H.264, MPEG-1, MPEG-2, MPEG-4, VC-1, Windows Media Video, DV.

Based on 3GPP data here. It seems that the file format itself supports multiple video and audio codecs. Only few of them are supported on Azure Media Encoder. Please use some 3rd party tool (like VLC) to double check the Audio and Video codecs of your 3GP file and make sure they are in the list of supported by Azure Media Encoder. And note that file extension does not define the codec used to encode the media within that file.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top