Tag Archives: python AudioSegment Read mp3 files Error

[Solved] python AudioSegment Read mp3 files Error: Python AudioSegment winError 2 The system cannot find the file specified

Today, run a sound mixing program using Python’s audiosegment from_Mp3 (mp3path) reports an error

Google said that the file ffmpeg is missing Exe and ffprobe Exe, and then I downloaded windows: https://github.com/BtbN/FFmpeg-Builds/releases?page=3

I use Python 3 6. I downloaded several

Use the first option:

Add directly to the code

    AudioSegment.converter = r"E:\s\ffmpeg-N-104843-gf176669a37-win64-lgpl-shared\ffmpeg-N-104843-gf176669a37-win64-lgpl-shared\bin\ffmpeffmpeg.exe"
    AudioSegment.ffprobe = r"E:\s\ffmpeg-N-104843-gf176669a37-win64-lgpl-shared\ffmpeg-N-104843-gf176669a37-win64-lgpl-shared\bin\ffprobe.exe"
    

Then run, fail, try, and all three fail…

Using the second scenario:

Directly copy the two exe files to the project running directory, and the third one failed.

Then use the two exe files in the second one successfully!!! I almost gave up ~ I succeeded

Another problem: there is a sound merging function in this folder, which can be called internally and run, but it can’t be adjusted for other files (different folders) to call this function, even if they don’t pass parameters…

Then I copy the two exe files to the folder where the PY file is located before I can run… I don’t know why…

Attached:

Audio mix (not splice):

    sound1 = AudioSegment.from_mp3("E:\\s\\CodeEditer\\1.mp3")
    sound2 = AudioSegment.from_mp3("E:\\s\\CodeEditer\\2.mp3")
    combined = sound1.overlay(sound2)
    combined.export("3.mp3", format='mp3')