python – Convert video to wav FFMPEG
“I am attempting to convert my input video file to audio in WAV format using ffmpeg and subprocess. However, I am encountering an error similar to the following:…”
import subprocess
def convert_video_to_wav(input_file, output_file):
try:
ffmpeg_cmd = [
"ffmpeg",
"-i", input_file,
"-vn",
"-acodec", "libmp3lame",
"-y",
output_file
]
subprocess.run(ffmpeg_cmd, check=True)
print(f"Successfully converted to WAV: {output_file}")
except subprocess.CalledProcessError as e:
print(f"Conversion failed: {e}")
input_file = "video.mp4"
output_file = "output_audio.wav" формате
convert_video_to_wav(input_file, output_file)
ERROR:
Conversion failed: Command ‘[‘ffmpeg’, ‘-i’, ‘video.mp4’, ‘-vn’, ‘-acodec’, ‘libmp3lame’, ‘-y’, ‘output_audio.wav’]’ returned non-zero exit status 4294967274.
Read more here: Source link
