使用的包是 ffmpeg-python
内容如下:
def ffmpeg_process(video_path, audio_path):
video_stream = ffmpeg.input(video_path)
audio_stream = ffmpeg.input(audio_path)
output_path = os.path.join(
OUTPUT_PATH,
VIDEO_MAP['GROUP_TITLE'],
)
output_path = os.path.join(output_path, VIDEO_MAP['OUTPUT_FILE'])
output_stream = ffmpeg.output(
video_stream,
audio_stream,
output_path,
vcodec='copy',
)
def count_none(Map):
Nones = sum(values is None for values in Map.values())
if Nones > 0:
return False
else:
return True
if count_none(VIDEO_MAP):
Build.makedir(output_path)
ffmpeg.run(output_stream)