jiaaro / pydub

Manipulate audio with a simple and easy high level interface
http://pydub.com
MIT License
8.96k stars 1.05k forks source link

pydub.exceptions.CouldntDecodeError: Decoding failed. ffmpeg returned error code: 69 #748

Open SuperFeda opened 1 year ago

SuperFeda commented 1 year ago

What's going to happen:

I want to write programs that takes an .mp3 file and converts it to an .ogg file.

Code:

from pydub import AudioSegment
from colorama import Fore
import os

ffprobe_path = r"ff_programs\\" #r"C:\Users\User\PycharmProjects\pythonProject\AudioManager\ff_programs"
os.environ["PATH"] += os.pathsep + ffprobe_path

def convert_to_ogg(mp3_file):
    audio = AudioSegment.from_file(mp3_file, "mp3")
    audio.export(mp3_file, format="ogg")

input_file = input("Путь к файлу формата mp3 ----> ")

try:
    convert_to_ogg(input_file)
except FileNotFoundError as e:
    print(f"{Fore.RED}[ERROR] Путь к файлу был указан не верно. {e}.{Fore.RESET}")

Error:

Error ``` Traceback (most recent call last): File "C:\Users\User\PycharmProjects\pythonProject\AudioManager\audio_manager.py", line 22, in convert_to_ogg(input_file) File "C:\Users\User\PycharmProjects\pythonProject\AudioManager\audio_manager.py", line 12, in convert_to_ogg audio = AudioSegment.from_file(mp3_file, "mp3") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\pydub\audio_segment.py", line 773, in from_file raise CouldntDecodeError( pydub.exceptions.CouldntDecodeError: Decoding failed. ffmpeg returned error code: 69 Output from ffmpeg/avlib: ffmpeg version N-111671-gc7ff0c3e4b-20230803 Copyright (c) 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=20230803 libavutil 58. 14.100 / 58. 14.100 libavcodec 60. 22.100 / 60. 22.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 [mp3float @ 000001973f83e880] Header missing Last message repeated 17 times [mp3 @ 000001973f833f00] Could not find codec parameters for stream 0 (Audio: mp3 (mp3float), 0 channels, fltp): unspecified frame size Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options Input #0, mp3, from 'ideoplayback.mp3': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Audio: mp3, 0 channels, fltp Stream mapping: Stream #0:0 -> #0:0 (mp3 (mp3float) -> pcm_s32le (native)) Press [q] to stop, [?] for help [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [mp3float @ 000001973f848000] Header missing [aist#0:0/mp3 @ 000001973f81c840] Error submitting packet to decoder: Invalid data found when processing input [graph_0_in_0_0 @ 000001973f7f4d00] Value inf for parameter 'time_base' out of range [0 - 2.14748e+09] Last message repeated 1 times [graph_0_in_0_0 @ 000001973f7f4d00] Error setting option time_base to value 1/0. [graph_0_in_0_0 @ 000001973f7f4d00] Error applying generic filter options. Error initializing filters! Error marking filters as finished Error while filtering: Result too large [aist#0:0/mp3 @ 000001973f81c840] Decode error rate 1 exceeds maximum 0.666667 [out#0/wav @ 000001973f816280] Nothing was written into output file, because at least one of its streams received no packets. size= 0kB time=N/A bitrate=N/A speed=N/A Conversion failed! ```

System configuration:

Sound: gdgdfg.zip