libavutil 58. 15.100 / 58. 15.100 libavcodec 60. 23.100 / 60. 23.100 libavformat 6

一、错误日志

ffmpeg version N-111719-gb98ee1a355-20230808 Copyright © 2000-2023 the FFmpeg developers
built with gcc 13.1.0 (crosstool-NG 1.25.0.196_227d99d)
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=–static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20230808
libavutil 58. 15.100 / 58. 15.100
libavcodec 60. 23.100 / 60. 23.100
libavformat 60. 10.100 / 60. 10.100
libavdevice 60. 2.101 / 60. 2.101
libavfilter 9. 10.100 / 9. 10.100
libswscale 7. 3.100 / 7. 3.100
libswresample 4. 11.100 / 4. 11.100
libpostproc 57. 2.100 / 57. 2.100
[in#0 @ 000001b5f77b0d40] Error opening input: No such file or directory
Error opening input file L:\webTTS\acdb\roles\Hina.
Error opening input files: No such file or directory
在这里插入图片描述
运行程序,利用ffmpeg将mp4转成wav报错

二·、原因与解决方法

文件路径中包含空格,你需要在命令行中将这个路径用引号括起来。以下是修改后的代码

import subprocess

def convert_mp4_to_wav(mp4_path, wav_path):
    command = f'ffmpeg -i "{
      
      mp4_path}" -vn -acodec pcm_s16le -ac 1 -ar 44100 -f wav "{
      
      wav_path}"'
    subprocess.call(command, shell=True)

# 测试函数
mp4_path = r'L:\webTTS\acdb\roles\Hina Suguta\Marin Kitagawa\4.mp4'
wav_path = r'L:\webTTS\audio.wav'
convert_mp4_to_wav(mp4_path, wav_path)

利用“”将含有空格的文件路径框起来,bug解决

猜你喜欢

转载自blog.csdn.net/qq_51116518/article/details/134023467
今日推荐