首页 > 解决方案 > 使用 ffmpeg 合并音频和视频 - Python Lib

问题描述

我努力了

import ffmpeg
video = ffmpeg.input('video.mp4')
audio = ffmpeg.input('audio.mp3')
ffmpeg.merge_outputs(video, audio).run()

它返回

TypeError: Expected incoming stream(s) to be of one of the following types: ffmpeg.nodes.OutputStream; got <class 'ffmpeg.nodes.FilterableStream'>

我试过了

import ffmpeg
video = ffmpeg.input('video.mp4')
audio = ffmpeg.input('audio.mp3')
ffmpeg.concat(video, audio, v=1, a=1).output('finished_video.mp4').run()

它返回

FileNotFoundError: [WinError 2] The system cannot find the file specified

我也试过

import subprocess    
subprocess.run("ffmpeg -i video.mp4 -i audio.mp3 -c copy output.mp4")

它返回

'ffmpeg' is not recognized as an internal or external command

我怎样才能做对?

标签: pythonaudiovideoffmpeg

解决方案


推荐阅读