我正在使用 azure 媒体服务
来存储视频等资源。现在我想将视频修剪
到前一分钟。假设视频为 5 分钟
,那么我想将其修剪为前 1 分钟
。我尝试使用以下代码
{
"Version": 1.0,
"Sources": [
{
"StartTime": "00:00:04",
"Duration": "00:00:16"
}
],
"Codecs": [
{
"KeyFrameInterval": "00:00:02",
"SceneChangeDetection": true,
"H264Layers": [
{
"Profile": "Auto",
"Level": "auto",
"Bitrate": 4500,
"MaxBitrate": 4500,
"BufferWindow": "00:00:05",
"Width": 1280,
"Height": 720,
"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"
}
}
]
}
我的问题是,有没有办法在不指定视频编解码器的情况下修剪视频,因为我只想修剪视频不想编码。就像使用这段代码
{
"Version": "1.0",
"Sources": [
{
"StartTime": "00:00:00",
"Duration": "00:01:00"
}
],
"Outputs": [
{
"FileName": "$filename$.mp4",
"Format": {
"Type": "MP4Format"
}
}
]
}
最佳答案
我猜您想要一个输出 MP4 以便离线下载/传送。
如果满足以下条件:
- 源是 MP4 文件,或者使用与 MP4 文件格式兼容的视频/音频编解码器(例如 H.264 视频、AAC 音频),并且
- 源代码采用封闭 GOP 进行编码
然后,您应该能够使用以下预设的 JSON,它告诉编码器复制输入的视频和音频:
{
"Version": "1.0",
"Sources": [
{
"StartTime": "00:00:00",
"Duration": "00:01:00"
}
],
"Outputs": [
{
"FileName": "$filename$.mp4",
"Format": {
"Type": "MP4Format"
}
}
],
"Codecs": [
{
"Type": "CopyVideo"
},
{
"Type": "CopyAudio"
}
]
}
关于没有编码器的 azure 媒体服务视频修剪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48400963/