如何使用Media Encoder Standard添加叠加层

时间:2016-02-17 13:43:14

标签: azure encoding azure-media-services

我正在尝试关注这篇文章:https://azure.microsoft.com/en-us/documentation/articles/media-services-custom-mes-presets-with-dotnet/#overlay

每次运行作业时,响应为:错误:TransientSystem:发生了瞬态错误。我们对不便表示抱歉。请再试一次。

这是我的自定义预设(我还在此回复的末尾添加了Sources元素:https://stackoverflow.com/a/34094014/5940469):

{
  "Version": 1.0,
  "Codecs": [
    {
      "KeyFrameInterval": "00:00:03",
      "SceneChangeDetection": true,
      "H264Layers": [
        {
          "Profile": "High",
          "Level": "4",
          "Bitrate": 8500,
          "MaxBitrate": 8500,
          "BufferWindow": "00:00:05",
          "Width": 1920,
          "Height": 1080,
          "BFrames": 3,
          "ReferenceFrames": 3,
          "AdaptiveBFrame": true,
          "Type": "H264Layer",
          "FrameRate": "0/1"
        }
      ],
      "Type": "H264Video"
    },
    {
      "Profile": "AACLC",
      "Channels": 2,
      "SamplingRate": 48000,
      "Bitrate": 192,
      "Type": "AACAudio"
    }
  ],
  "Outputs": [
    {
      "FileName": "{Basename}_hi.mp4",
      "Format": {
        "Type": "MP4Format"
      }
    }
  ],
  "Sources": [
    {
      "Streams": [ ],
      "Filters": {
        "VideoOverlay": {
          "Position": {
            "X": 100,
            "Y": 100,
            "Width": 100,
            "Height": 106
          },
          "AudioGainLevel": 0.0,
          "MediaParams": [
            {
              "OverlayLoopCount": 1
            },
            {
              "IsOverlay": true,
              "OverlayLoopCount": 1,
              "InputLoop": true
            }
          ],
          "Source": "logo.jpg",
          "Clip": {
            "Duration": "00:00:05"
          },
          "FadeInDuration": {
            "Duration": "00:00:01"
          },
          "FadeOutDuration": {
            "StartTime": "00:00:03",
            "Duration": "00:00:04"
          }
        }
      },
      "Pad": true
    }
  ]
}

没有Sources元素,作业就会正确完成。

这是我用来创建作业的代码:

var job = context.Jobs.Create("New Job");
var processor = find the processor that has name "Media Encoder Standard"...
var preset = readtextfromjson...
var task = job.Tasks.AddNew("Video with overlay", processor, preset, TaskOptions.None);
task.InputAssets.Add(videoAsset);
task.InputAssets.Add(logoAsset);
task.OutputAssets.AddNew("Output files", AssetCreationOptions.None);
await job.SubmitAsync();
await job.GetExecutionProgressTask(cancellationToken);

logoAsset的assetFile名为“logo.jpg”。

1 个答案:

答案 0 :(得分:0)

此时使用单个输入资产。将徽标和视频放入同一资产中。确保他们的视频文件设置为资产中的主文件。

这是一个已知问题,我们正在努力修复以支持单独的“徽标”资产。