1

I want to use ffmpeg to download a video from Youtube to mp3

The code is:

from __future__ import unicode_literals
import youtube_dl

ydl_opts = {'format': 'bestaudio/best',
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192',
    }],
}

with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['the_url'])

But obviously I get the error: ffprobe/avprobe and ffmpeg/avconv not found. Please install one.

I installed ffmpeg but my question is do I need to import something now or put path were I saved the .exe

anonimostilton
  • 170
  • 1
  • 16

1 Answers1

2

The problem was that I forgot restarting Jupyter. But before you need to add the path of the directory that contains the ffmpeg executables to the PATH environment variable. I found a video that explains it pretty well on Youtube: https://www.youtube.com/watch?v=qjtmgCb8NcE&ab_channel=LinuxLeech

anonimostilton
  • 170
  • 1
  • 16