Azure media services Azure媒体服务-v3覆盖位置问题
我正在开发一个编码流程,将覆盖图像添加到视频中。我希望这个水印在右下角。无论我如何尝试使用position参数,水印都位于左上角 有人能给我举一个例子来说明这种情况吗?Microsoft文档和示例对覆盖层的定位和不透明度的设置含糊不清 下面是一段包含我的转换定义的代码。无论覆盖设置如何,我都可以使用矩形位置元素的任何值,并且不会发生任何更改。水印位于视频的右上角。它就像位置和不透明度属性被忽略一样Azure media services Azure媒体服务-v3覆盖位置问题,azure-media-services,Azure Media Services,我正在开发一个编码流程,将覆盖图像添加到视频中。我希望这个水印在右下角。无论我如何尝试使用position参数,水印都位于左上角 有人能给我举一个例子来说明这种情况吗?Microsoft文档和示例对覆盖层的定位和不透明度的设置含糊不清 下面是一段包含我的转换定义的代码。无论覆盖设置如何,我都可以使用矩形位置元素的任何值,并且不会发生任何更改。水印位于视频的右上角。它就像位置和不透明度属性被忽略一样 new AMSModels.TransformOutput( new A
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);
}
new AMSModels.TransformOutput(
新AMSModels.StandardEncoderPreset(
过滤器:新AMSMODEL。过滤器
{
覆盖层=新列表
{
新的AMSModels.VideoOverlay()
{
InputLabel=“tbvvideooverlay”,
不透明度=.5,
Position=new AMSModels.Rectangle(){Left=“100”,Top=“100”,Width=“100”,Height=“100”}/**我在这里尝试了所有类型的值,包括百分比,在重新编码视频时没有任何变化**
}
}
},
编解码器:新AMSModels.Codec[]
{
//为音频编码添加AAC音频层
新阿姆斯摩代尔酒店(
频道:2,
抽样人数:48000,
比特率:128000,
配置文件:AMSModels.AacAudioProfile.AacLc
),
//接下来,为视频编码添加H264视频
新AMSModels.H264视频(
//将所有H264层的GOP间隔设置为2秒
keyFrameInterval:TimeSpan.FromSeconds(2),
//添加H264层。指定可用于输出文件名的标签
图层:新AMSMODEL.H264图层[]
{
新AMSModels.H264图层(
比特率:3600000,//单位为比特/秒,而不是kbps或Mbps-3.6 Mbps或3600 kbps
宽度:“1280”,
高度:“720”,
标签:“3600”//此标签用于修改输出格式中的文件名
),
新AMSModels.H264图层(
比特率:1600000,//单位为比特/秒,而不是kbps或Mbps-1.6 Mbps或1600 kbps
宽度:“960”,
高度:“540”,
标签:“1600”//此标签用于修改输出格式中的文件名
),
新AMSModels.H264图层(
比特率:600000,//单位为比特/秒,而不是kbps或Mbps-0.6 Mbps或600 kbps
宽度:“640”,
高度:“360”,
标签:“600”//此标签用于修改输出格式中的文件名
),
}
),
//还生成一组PNG缩略图
新建AMSModels.PngImage(
开始:“10%”,
步骤:“10%”,
范围:“90%”,
层:新Microsoft.Azure.Management.Media.Models.PngLayer[]{
新阿姆斯莫代尔酒店(
宽度:“100%”,
身高:“100%”
)
}
),
新AMSModels.JpgImage(
开始:“10%”,
步骤:“10%”,
范围:“90%”,
层:新Microsoft.Azure.Management.Media.Models.JpgLayer[]{
新建AMSModels.JpgLayer(
质量:100,
宽度:“100%”,
身高:“100%”
)
}
)
},
//指定输出文件的格式-一个用于视频+音频,另一个用于缩略图
格式:新AMSMODEL.Format[]
{
//使用basename、label、bitrate和extension宏将H.264视频和AAC音频多路复用到MP4文件中
//请注意,由于上面定义了多个H264层,因此必须使用宏为每个H264层生成唯一的名称
//{Label}或{Bitrate}应该足够了
新的AMSModels.MP4格式(
filenamePattern:“{Basename}{Resolution}{Bitrate}{Extension}”
),
新AMSModels.PngFormat(
filenamePattern:“缩略图-{Basename}-{Index}{Extension}”
),
新AMSModels.jpg格式(
filenamePattern:“缩略图-{Basename}-{Index}{Extension}”
)
}
),
OneError:AMSModels.OneErrorType.StoppProcessingJob,
相对优先级:AMSModels.Priority.Normal
)
};
string description=“具有2 MP4比特率的简单自定义编码转换”;