输入错误:源视频在 Azure 媒体服务中具有 avg_frame_rate NaN fps 和 r_frame_rate 90000 fps

Bad input: the source video has an avg_frame_rate of NaN fps and r_frame_rate of 90000 fps in Azure Media Service

我尝试将歌曲 (.mp4) 文件格式上传到媒体服务。它已成功上传,但是,当我尝试创建编码作业时,我遇到了下面提到的错误。对于少数文件,我收到以下错误,而对于少数文件,则不是。无法确定错误是什么以及如何解决这个问题?

错误信息:

    Encoding task
ErrorProcessingTask : An error has occurred. Stage: ApplyEncodeCommand. Code: System.IO.InvalidDataException.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->
System.IO.InvalidDataException: Bad input: the source video has an avg_frame_rate of NaN fps and r_frame_rate of 90000 fps.

代码: 使用编码“H264 多比特率 720p

static public IAsset CreateEncodingJob(IAsset asset, string preset,string fileName)
        {           
            IJob job = _context.Jobs.Create(preset + " encoding job");
            var mediaProcessors =
                  _context.MediaProcessors.Where(p => p.Name.Contains("Media Encoder Standard")).ToList();
            var latestMediaProcessor =
                mediaProcessors.OrderBy(mp => new Version(mp.Version)).LastOrDefault();
            ITask task = job.Tasks.AddNew(preset + " encoding task",
                latestMediaProcessor,
                preset, 
                Microsoft.WindowsAzure.MediaServices.Client.TaskOptions.ProtectedConfiguration);            
         task.InputAssets.Add(asset);
         task.OutputAssets.AddNew(fileName + " " + preset,
                AssetCreationOptions.None);
         job.StateChanged += new
                    EventHandler<JobStateChangedEventArgs>(StateChanged);

            job.Submit();


            LogJobDetails(job.Id);

            Task progressJobTask = job.GetExecutionProgressTask(CancellationToken.None);
            progressJobTask.Wait();

            if (job.State == JobState.Error)
            {
                throw new Exception("\nExiting method due to job error.");
            }

            return job.OutputMediaAssets[0];
        }

谁能帮我解决这个问题?

找到解决方案:Click here

重新发布评论:

您的编码任务失败,因为输入视频报告的标称帧速率太高或太低。您将必须覆盖编码预设中的输出帧速率设置。假设你知道输入视频已经录制在30frames/second,那么:

  1. https://msdn.microsoft.com/en-us/library/azure/mt269953.aspx

  2. 中获取 JSON 的 "H264 Multiple Bitrate 720p"
  3. Edit/replace 每个 "FrameRate": "0/1" 条目 "FrameRate": "30/1"。请注意,有多个条目需要替换。

  4. 保存结果JSON

  5. 提交编码任务时,在CreateEncodingTask中,将字符串"preset"替换为整个JSON(通过使用System.IO.File.ReadAllText("song.Json") )


此致, 迪利普