建立 VOD 來源檔案

如果您還沒有自己的隨選影片 (VOD) 素材資源,可以使用 Transcoder API 建立 VOD 資訊清單,並分割可與 Video Stitcher API 搭配使用的檔案。這完全是可選的。

VOD 資訊清單會用於 VOD 設定中的來源 URI。系統支援 DASH 和 HLS 格式。

以下是工作設定範例,您可以搭配 Transcoder API 使用這項設定,建立 VOD 檔案。詳情請參閱「使用臨時設定建立工作」。您必須在 Google Cloud專案中啟用 Transcoder API。如需更多資訊,請參閱「開始前」一節。

{
  "config":{
    "inputs":[
      {
        "key":"input0",
        "uri":"gs://STORAGE_BUCKET_NAME/STORAGE_INPUT_VIDEO"
      }
    ],
    "output":{
      "uri":"gs://STORAGE_BUCKET_NAME/STORAGE_OUTPUT_FOLDER/"
    },
    "editList":[
      {
        "key":"atom0",
        "inputs":[
          "input0"
        ]
      }
    ],
    "elementaryStreams":[
      {
        "key":"video_hd",
        "videoStream":{
          "h264":{
            "heightPixels":720,
            "widthPixels":1280,
            "pixelFormat":"yuv420p",
            "bitrateBps":5000000,
            "frameRate":25
          }
        }
      },
      {
        "key":"video_sd",
        "videoStream":{
          "h264":{
            "heightPixels":432,
            "widthPixels":768,
            "pixelFormat":"yuv420p",
            "bitrateBps":1100000,
            "frameRate":25
          }
        }
      },
      {
        "key":"video_sd_low",
        "videoStream":{
          "h264":{
            "heightPixels":360,
            "widthPixels":640,
            "pixelFormat":"yuv420p",
            "bitrateBps":365000,
            "frameRate":25
          }
        }
      },
      {
        "key":"audio_stereo",
        "audioStream":{
          "codec":"aac",
          "bitrateBps":64000,
          "channelCount":2,
          "channelLayout":[
            "fl",
            "fr"
          ],
          "sampleRateHertz":48000
        }
      }
    ],
    "muxStreams":[
      {
        "key":"hd",
        "container":"mp4",
        "elementaryStreams":[
          "video_hd",
          "audio_stereo"
        ],
        "segmentSettings":{
          "segmentDuration":"6s",
          "individualSegments":true
        }
      },
      {
        "key":"sd",
        "container":"mp4",
        "elementaryStreams":[
          "video_sd",
          "audio_stereo"
        ],
        "segmentSettings":{
          "segmentDuration":"6s",
          "individualSegments":true
        }
      },
      {
        "key":"sd_low",
        "container":"mp4",
        "elementaryStreams":[
          "video_sd_low",
          "audio_stereo"
        ],
        "segmentSettings":{
          "segmentDuration":"6s",
          "individualSegments":true
        }
      },
      {
        "key":"media_hd",
        "container":"ts",
        "elementaryStreams":[
          "video_hd",
          "audio_stereo"
        ],
        "segmentSettings":{
          "segmentDuration":"6s",
          "individualSegments":true
        }
      },
      {
        "key":"media_sd",
        "container":"ts",
        "elementaryStreams":[
          "video_sd",
          "audio_stereo"
        ],
        "segmentSettings":{
          "segmentDuration":"6s",
          "individualSegments":true
        }
      },
      {
        "key":"media_sd_low",
        "container":"ts",
        "elementaryStreams":[
          "video_sd_low",
          "audio_stereo"
        ],
        "segmentSettings":{
          "segmentDuration":"6s",
          "individualSegments":true
        }
      },
      {
        "key":"video_only_hd",
        "container":"fmp4",
        "elementaryStreams":[
          "video_hd"
        ],
        "segmentSettings":{
          "segmentDuration":"6s",
          "individualSegments":true
        }
      },
      {
        "key":"video_only_sd",
        "container":"fmp4",
        "elementaryStreams":[
          "video_sd"
        ],
        "segmentSettings":{
          "segmentDuration":"6s",
          "individualSegments":true
        }
      },
      {
        "key":"video_only_sd_low",
        "container":"fmp4",
        "elementaryStreams":[
          "video_sd_low"
        ],
        "segmentSettings":{
          "segmentDuration":"6s",
          "individualSegments":true
        }
      },
      {
        "key":"audio_only",
        "container":"fmp4",
        "elementaryStreams":[
          "audio_stereo"
        ],
        "segmentSettings":{
          "segmentDuration":"6s",
          "individualSegments":true
        }
      }
    ],
    "manifests":[
      {
        "type":"HLS",
        "fileName":"manifest.m3u8",
        "muxStreams":[
          "media_hd",
          "media_sd",
          "media_sd_low"
        ]
      },
      {
        "type":"DASH",
        "fileName":"manifest.mpd",
        "muxStreams":[
          "video_only_hd",
          "video_only_sd",
          "video_only_sd_low",
          "audio_only"
        ]
      }
    ]
  }
}