azure-media-services - Azure 媒体服务 - v3 覆盖位置问题
问题描述
我正在研究一种将叠加图像添加到视频的编码流程。我希望这个水印在右下角。无论我尝试使用位置参数,水印都位于左上角。
有人可以指出一个涵盖该场景的示例吗?Microsoft 文档和示例对定位叠加层和设置不透明度含糊不清。
这是包含我的转换定义的代码片段。无论覆盖设置如何,我都可以为矩形位置元素使用任何值,并且没有任何变化。水印最终出现在视频的右上角。它就像位置和不透明度属性被忽略了。
new AMSModels.TransformOutput(
new AMSModels.StandardEncoderPreset(
filters: new AMSModels.Filters
{
Overlays = new List<AMSModels.Overlay>
{
new AMSModels.VideoOverlay()
{
InputLabel = "tbvvideooverlay",
Opacity = .5,
Position = new AMSModels.Rectangle(){ Left = "100", Top = "100", Width = "100", Height = "100"} //**I've tried all types of values here including percentages, nothing changes when I reencode the video.**
}
}
},
codecs: new AMSModels.Codec[]
{
// Add an AAC Audio layer for the audio encoding
new AMSModels.AacAudio(
channels: 2,
samplingRate: 48000,
bitrate: 128000,
profile: AMSModels.AacAudioProfile.AacLc
),
// Next, add a H264Video for the video encoding
new AMSModels.H264Video (
// Set the GOP interval to 2 seconds for all H264Layers
keyFrameInterval:TimeSpan.FromSeconds(2),
// Add H264Layers. Assign a label that you can use for the output filename
layers: new AMSModels.H264Layer[]
{
new AMSModels.H264Layer (
bitrate: 3600000, // Units are in bits per second and not kbps or Mbps - 3.6 Mbps or 3,600 kbps
width: "1280",
height: "720",
label: "3600" // This label is used to modify the file name in the output formats
),
new AMSModels.H264Layer (
bitrate: 1600000, // Units are in bits per second and not kbps or Mbps - 1.6 Mbps or 1600 kbps
width: "960",
height: "540",
label: "1600" // This label is used to modify the file name in the output formats
),
new AMSModels.H264Layer (
bitrate: 600000, // Units are in bits per second and not kbps or Mbps - 0.6 Mbps or 600 kbps
width: "640",
height: "360",
label: "600" // This label is used to modify the file name in the output formats
),
}
),
// Also generate a set of PNG thumbnails
new AMSModels.PngImage(
start: "10%",
step: "10%",
range: "90%",
layers: new Microsoft.Azure.Management.Media.Models.PngLayer[]{
new AMSModels.PngLayer(
width: "100%",
height: "100%"
)
}
),
new AMSModels.JpgImage(
start: "10%",
step: "10%",
range: "90%",
layers: new Microsoft.Azure.Management.Media.Models.JpgLayer[]{
new AMSModels.JpgLayer(
quality: 100,
width: "100%",
height: "100%"
)
}
)
},
// Specify the format for the output files - one for video+audio, and another for the thumbnails
formats: new AMSModels.Format[]
{
// Mux the H.264 video and AAC audio into MP4 files, using basename, label, bitrate and extension macros
// Note that since you have multiple H264Layers defined above, you have to use a macro that produces unique names per H264Layer
// Either {Label} or {Bitrate} should suffice
new AMSModels.Mp4Format(
filenamePattern:"{Basename}_{Resolution}_{Bitrate}{Extension}"
),
new AMSModels.PngFormat(
filenamePattern:"Thumbnail-{Basename}-{Index}{Extension}"
),
new AMSModels.JpgFormat(
filenamePattern:"Thumbnail-{Basename}-{Index}{Extension}"
)
}
),
onError: AMSModels.OnErrorType.StopProcessingJob,
relativePriority: AMSModels.Priority.Normal
)
};
string description = "A simple custom encoding transform with 2 MP4 bitrates";
// Create the custom Transform with the outputs defined above
transform = await client.Transforms.CreateOrUpdateAsync(resourceGroupName, accountName, transformName, outputs, description);
}
谢谢!
解决方案
非常感谢您发现并指出这一问题。我们对此进行了查看并确认确实存在您在这里发现的错误!首先,感谢您发现这个问题并报告它。
现在是坏消息,现在我们将不得不考虑修复它并将修复程序重新部署到生产环境中。这对我们来说可能需要一些时间,所以如果您需要一个快速的解决方案,我唯一可以建议的是使用较旧的 v2 API(是的,我们宣布弃用的那个)来解决这个问题,直到我们可以将代码修复到生产中。
如果适合您,这是在 v2 中执行此操作的旧方法 - https://docs.microsoft.com/en-us/azure/media-services/previous/media-services-advanced-encoding-with-mes#覆盖
推荐阅读
- orbeon - 如何使屏幕阅读器可以使用提示文本?
- arrays - 如何找到数字数组中的所有范围
- ruby-on-rails - Watir:元素存在但.exists?返回假
- git - 删除分支后测试 Git 存储库大小减少
- php - php 函数参数的数据类型的行为
- c# - 相似配置文件推荐的机器学习算法(ML.NET 库).NET C#
- c# - 使用 C# 代码统一导入 .step 文件?
- c - libusb 设备描述符:bcdUSB 可能值
- robotframework - 如何使用 Robot Framework 编写代码来操作重复登录和注销多个凭据
- python - 我刮掉了标题和价格以及链接和信息表,我将其命名为planet_data,当我编写csv文件时,我得到了重复的planet_data