Code cannot locate ffmpeg file - followed the instructions

Question:
Getting the following error:

ERROR: Postprocessing: ffprobe and ffmpeg not found. Please install or provide the path using --ffmpeg-location

Code:

def process_videos(txt_file, mp3_dir, split_dir, transcription_folder, openai_api_key=openai_api_key):
    # Rest of the function here
    # YouTube-dl options
    ydl_opts = {
        'format': 'bestaudio/best',
        'outtmpl': os.path.join(mp3_dir, '%(title)s.%(ext)s'),
        'postprocessors': [
            {
                'key': 'FFmpegExtractAudio',
                'preferredcodec': 'mp3',
                'preferredquality': '66',
            }
        ],
'ffmpeg_location': 'Transcriber/.env',
    }
  1. Try removing ffmpeg_location': 'Transcriber/.env', line
  2. Go to replit.nix and add pkgs.ffmpeg in it.
  3. Reload if it didnt automatically
1 Like

Is this correct? Because I already did this, but maybe I did it wrong. My replit.nix file looks like this:

pkgs = {
  ffmpeg.bin = pkgs.ffmpeg;
  libopus = pkgs.libopus;
};

~~Try changing:

To this:

pkgs = {
  pkgs.ffmpeg,
  pkgs.libopus
}

Probably use what @element1010 provided, I was half asleep when I posted this.

2 Likes

I’m not sure, but I think the Nix format should be like this:

{ pkgs }: {
  deps = [
    pkgs.ffmpeg
    pkgs.libopus
  ];
}
4 Likes

That seemed to help a bit. I added the code to the pre-existing replit.nix file in my Replit in this manner, and it seemed to do the trick:

{ pkgs }: {
  deps = [
    pkgs.python310Full
    pkgs.replitPackages.prybar-python310
    pkgs.replitPackages.stderred
    pkgs.libopus
    pkgs.ffmpeg
  ];
2 Likes