0

尝试在 Azure 媒体服务中上传、转换/编码和准备 .3gp 视频文件时,我们收到错误消息,File type or codec not supported.根据此信息,应支持导入 3gp。如何正确导入 3gp 并将其转换为 MP4?

这是我们的内部日志所说的:

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.

我们的代码:

/// <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;
}
4

1 回答 1

1

您应该查看Azure 媒体编码器格式和编解码器,而不是 Microsoft 表达式编码器支持的文件格式。

上述文档声明.3GPP.3GPP2支持文件格式。并且视频编解码器非常有限:H.264, MPEG-1, MPEG-2, MPEG-4, VC-1, Windows Media Video, DV.

根据这里3GPP的数据。文件格式本身似乎支持多种视频和音频编解码器。Azure 媒体编码器仅支持其中的少数。请使用一些 3rd 方工具(如VLC)仔细检查您的文件,并确保它们在 Azure 媒体编码器支持的列表中。请注意,文件扩展名并未定义用于对该文件中的媒体进行编码的编解码器。Audio and Video codecs3GP

于 2013-07-31T05:06:03.903 回答