我asked this question on the MSDN forums,但一如既往 - 等待来自那里的回复毫无意义。
我现在要做的是让用户使用Media Encoder Standard编码器和自定义预设来修剪视频的开头和结尾。但是因为它没有记录在任何地方(尽管是“推荐的”编码器),我无法让它工作。这是我添加到标准编码预设JSON对象的内容:
customPreset.Sources = [
{
'Clips': [
{
'StartTime': '00:00:10', //sample values
'EndTime': '00:02:03'
}
]
}
];
预设的其余部分是略微修改的自适应比特率预设,已经过测试可以正常工作:
"Codecs": [
{
"KeyFrameInterval": "00:00:02",
"H264Layers": [
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 5500,
"MaxBitrate": 6000,
"BufferWindow": "00:00:05",
"Width": 1920,
"Height": 1080,
"BFrames": 3,
"ReferenceFrames": 3,
"AdaptiveBFrame": true,
"Type": "H264Layer",
"FrameRate": "0/1"
},
...//and so on, then image layers for thumbnails and audio profile
但是,当我开始将此Sources
属性添加到预设的编码作业时,不会裁剪生成的资源。所以我假设我做错了什么?由于微软似乎不想记录这个编码器(至少目前为止),有没有人做过这样的事情,谁可以告诉我如何修改预设以启用此任务?
我很可能需要进行更高级的编辑,例如子剪辑,拼接和稍后添加自定义音频轨道,这样有助于了解编码预设中的所有内容(以及此MES实际支持的内容) )。
答案 0 :(得分:1)
我刚尝试了以下预设,并根据需要成功修剪了我的视频。 Sources元素在最后定义。
{
"Version": 1.0,
"Codecs": [
{
"KeyFrameInterval": "00:00:02",
"StretchMode": "AutoSize",
"H264Layers": [
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 3400,
"MaxBitrate": 3400,
"BufferWindow": "00:00:05",
"Width": 1280,
"Height": 720,
"BFrames": 3,
"ReferenceFrames": 3,
"AdaptiveBFrame": true,
"Type": "H264Layer",
"FrameRate": "0/1"
},
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 2250,
"MaxBitrate": 2250,
"BufferWindow": "00:00:05",
"Width": 960,
"Height": 540,
"BFrames": 3,
"ReferenceFrames": 3,
"AdaptiveBFrame": true,
"Type": "H264Layer",
"FrameRate": "0/1"
},
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 1500,
"MaxBitrate": 1500,
"BufferWindow": "00:00:05",
"Width": 960,
"Height": 540,
"BFrames": 3,
"ReferenceFrames": 3,
"AdaptiveBFrame": true,
"Type": "H264Layer",
"FrameRate": "0/1"
},
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 1000,
"MaxBitrate": 1000,
"BufferWindow": "00:00:05",
"Width": 640,
"Height": 360,
"BFrames": 3,
"ReferenceFrames": 3,
"AdaptiveBFrame": true,
"Type": "H264Layer",
"FrameRate": "0/1"
},
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 650,
"MaxBitrate": 650,
"BufferWindow": "00:00:05",
"Width": 640,
"Height": 360,
"BFrames": 3,
"ReferenceFrames": 3,
"AdaptiveBFrame": true,
"Type": "H264Layer",
"FrameRate": "0/1"
},
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 400,
"MaxBitrate": 400,
"BufferWindow": "00:00:05",
"Width": 320,
"Height": 180,
"BFrames": 3,
"ReferenceFrames": 3,
"AdaptiveBFrame": true,
"Type": "H264Layer",
"FrameRate": "0/1"
}
],
"Type": "H264Video"
},
{
"Profile": "AACLC",
"Channels": 2,
"SamplingRate": 48000,
"Bitrate": 128,
"Type": "AACAudio"
}
],
"Outputs": [
{
"FileName": "{Basename}_{Width}x{Height}_{VideoBitrate}.mp4",
"Format": {
"Type": "MP4Format"
}
}
],
"Sources": [
{
"StartTime": "00:00:04",
"Duration": "00:00:16"
}
]
}