没有编码器的 azure 媒体服务视频 trim

azure media service video trim without encoder

我正在使用 azure media service 来存储我的资产,例如视频。现在我想 trim 视频播放到第一分钟。假设视频是 5 minute 那么我想 trim 到 first 1 minute。我尝试使用以下代码

{  
  "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"  
      }  
    }  
  ]  
}  

我的问题是,有没有什么方法可以在不指定视频 codecs 的情况下 trim 视频,因为我只想 trim 视频不想编码。喜欢使用此代码

{
  "Version": "1.0",
  "Sources": [
    {
      "StartTime": "00:00:00",
      "Duration": "00:01:00"
    }
  ],
  "Outputs": [
    {
      "FileName": "$filename$.mp4",
      "Format": {
        "Type": "MP4Format"
      }
    }
  ]
}

我想你想要 downloading/delivering 离线输出 MP4。

如果满足以下条件:

  1. 来源是 MP4 文件,或者它使用 video/audio 与 MP4 文件格式兼容的编解码器(例如 H.264 视频、AAC 音频),并且
  2. 源代码使用封闭 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"
    }
  ]
}