我有两个mp4文件。一个只包含视频,另一个只包含音频。两者具有完全相同的长度(从HLS流中提取的一些秒数)。
我希望他们现在得到混合在一起,通过一个GCS转码器API作业得到触发的数据流管道。查阅文档还没有找到解决方案。
我当前的Job配置是这样的:
gcs_video = "gcs://abc/video.mp4"
gcs_audio = "gcs://abc/audio.mp4"
video_input = transcoder_v1.types.Input(key="input0", uri=gcs_video)
audio_input = transcoder_v1.types.Input(key="input1", uri=gcs_audio)
job.config = transcoder_v1.types.JobConfig(
inputs=[video_input, audio_input],
elementary_streams=[
transcoder_v1.types.ElementaryStream(
key="video-stream0",
video_stream=transcoder_v1.types.VideoStream(
h264=transcoder_v1.types.VideoStream.H264CodecSettings(
height_pixels=720,
width_pixels=1280,
bitrate_bps=2500000,
frame_rate=30,
),
),
),
transcoder_v1.types.ElementaryStream(
key="audio-stream0",
audio_stream=transcoder_v1.types.AudioStream(
codec="aac", bitrate_bps=64000
),
),
],
mux_streams=[
transcoder_v1.types.MuxStream(
key="hd",
container="mp4",
elementary_streams=["video-stream0", "audio-stream0"],
),
],
)
稍后我们将添加一些叠加并将其转换为不同的格式。但现在,如果我能让他们在一起,我已经很高兴了:)
文档中没有列出一些默认值。尝试将以下内容添加到您的配置中,看看是否有效
"editList":[
{
"key":"atom0",
"inputs":[
"video_input_key",
"audio_input_key"
],
"startTimeOffset":"0s"
}
]
感谢@TJ Liu的回答,我能够为我的转码工作找出正确的配置。结束配置如下所示:
gcs_video = "gcs://abc/video.mp4"
gcs_audio = "gcs://abc/audio.mp4"
video_input = transcoder_v1.types.Input(key="input0", uri=gcs_video)
audio_input = transcoder_v1.types.Input(key="input1", uri=gcs_audio)
clip_duration = 9
job.config = transcoder_v1.types.JobConfig(
inputs=[video_input, audio_input],
edit_list=[
transcoder_v1.types.EditAtom(
key="atom0",
inputs=["input0", "input1"],
end_time_offset = Duration(seconds=clip_duration)
)
],
elementary_streams=[
transcoder_v1.types.ElementaryStream(
key="video-stream0",
video_stream=transcoder_v1.types.VideoStream(
h264=transcoder_v1.types.VideoStream.H264CodecSettings(
height_pixels=720,
width_pixels=1280,
bitrate_bps=2500000,
frame_rate=30,
),
),
),
transcoder_v1.types.ElementaryStream(
key="audio-stream0",
audio_stream=transcoder_v1.types.AudioStream(
codec="aac", bitrate_bps=64000
),
),
],
mux_streams=[
transcoder_v1.types.MuxStream(
key="hd",
container="mp4",
elementary_streams=["video-stream0", "audio-stream0"],
),
],
)