# Fix Couldn’t find ffmpeg or avconv in pydub – Python Tutorial

By | December 14, 2021

When we are using python pydub to convert audio files, we may get this error: Couldn’t find ffmpeg or avconv. In this tutorial, we will introduce you how to do.

For example:

Pydub will use os.environ[“PATH”] to find ffprobe.exe and ffmpeg.exe.

In order to install ffprobe.exe or ffmpeg.exe, you can read this tutorial:

View Audio Sample Rate, Data Format PCM or ALAW Using ffprobe – Python Tutorial

## How to fix this error?

The simplest way is to add the installation path of ffmpeg.exe to your compute environment variable. However, if you do not want to add, you can fix this error manually.

For example, if the installation path of ffmpeg.exe is: D:\ffmpeg\bin, we can add it as follows:

envdir_list.append(r'D:\ffmpeg\bin')

Then this error can fixed.

However, we also have to edit other source code to make ffprobe.exe and ffmpeg.exe can be called by python Popen.

Implement Python subprocess.Popen(): Execute an External Command and Get Output

For example: in utils.py

in audio_segment.py

The aim is to make pydub can use subprocess.Popen() to call D:\ffmpeg\bin\ffprobe.exe and D:\ffmpeg\bin\ffmpeg.exe.

Then, you can find this error is fixed.