FFmpeg Pydub Debugging/Conversion Failed, ffmpeg returned error code: 1


I have a simple line of code importing an mp3 file, it used to give me a WinError2 error which I fixed by adding the ffmpeg exe's into the script directory. But now I have another error which I cannot really make heads or tails of:

The lines of code:

AudioSegment.converter = r"path/to/directory/ffmpeg.exe"

AudioSegment.ffprobe = r"path/to/directory/ffprobe.exe"

imported_mp3 = AudioSegment.from_mp3(Path(file_path))

The error message:

Traceback (most recent call last):
  File "C:\Users\my_user\OneDrive\Desktop\DIR\project.py", line 673, in <module>
    main()
  File "C:\Users\my_user\OneDrive\Desktop\DIR\project.py", line 665, in main
    read_titles(txt_path)
  File "C:\Users\my_user\OneDrive\Desktop\DIR\project.py", line 588, in the_function
    temp_voice = AudioSegment.from_mp3(import_path)
  File "C:\Users\my_user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pydub\audio_segment.py", line 796, in from_mp3
    return cls.from_file(file, 'mp3', parameters=parameters)
  File "C:\Users\my_user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pydub\audio_segment.py", line 773, in from_file
    raise CouldntDecodeError(
pydub.exceptions.CouldntDecodeError: Decoding failed. ffmpeg returned error code: 1

Output from ffmpeg/avlib:

ffmpeg version 2021-07-14-git-ca56299fb3-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.3.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      57.  0.100 / 57.  0.100
  libavcodec     59.  3.101 / 59.  3.101
  libavformat    59.  4.100 / 59.  4.100
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.103 /  8.  0.103
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
[mp3float @ 000001bf73e87b80] Header missing
    Last message repeated 27 times
[mp3 @ 000001bf73e7e540] decoding for stream 0 failed
[mp3 @ 000001bf73e7e540] 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 'C:\Users\my_user\0.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_s16le (native))
Press [q] to stop, [?] for help
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[mp3float @ 000001bf73e90f80] Header missing
Error while decoding stream #0:0: Invalid data found when processing input
[abuffer @ 000001bf73e9b240] Value inf for parameter 'time_base' out of range [0 - 2.14748e+09]
    Last message repeated 3 times
[abuffer @ 000001bf73e9b240] Error setting option time_base to value 1/0.
[graph_0_in_0_0 @ 000001bf73e9c2c0] Error applying options to the filter.
Error reinitializing filters!
Error while filtering: Result too large
Finishing stream 0:0 without any data written to it.
[abuffer @ 000001bf73e9d4c0] Value inf for parameter 'time_base' out of range [0 - 2.14748e+09]
    Last message repeated 3 times
[abuffer @ 000001bf73e9d4c0] Error setting option time_base to value 1/0.
[graph_0_in_0_0 @ 000001bf73eaa0c0] Error applying options to the filter.
Error configuring filter graph
Conversion failed!



Read more here: https://stackoverflow.com/questions/68474078/ffmpeg-pydub-debugging-conversion-failed-ffmpeg-returned-error-code-1

Content Attribution

This content was originally published by Draco at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: