1

This is my current code, using youtube_dl:

from __future__ import unicode_literals 
     import youtube_dl 
     import ffmpeg
     ydl_opts = { 
      'format': 'bestaudio/best', 
      'postprocessors': [{ 
         'key': 'FFmpegExtractAudio', 
        'preferredcodec': 'mp3',  
        'preferredquality': '320',   # selected mp3 and 320
    }],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download([input('Youtube link: ')])

It works but gives me different types. I get this error:

ERROR: ffprobe/avprobe and ffmpeg/avconv not found. Please install one.
Traceback (most recent call last):
  File "C:\Users\Eng-Ahmed Saleh\PycharmProjects\untitled5\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 2054, in post_process
    files_to_delete, info = pp.run(info)
  File "C:\Users\Eng-Ahmed Saleh\PycharmProjects\untitled5\venv\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 272, in run
    filecodec = self.get_audio_codec(path)
  File "C:\Users\Eng-Ahmed Saleh\PycharmProjects\untitled5\venv\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 166, in get_audio_codec
    raise PostProcessingError('ffprobe/avprobe and ffmpeg/avconv not found. Please install one.')
youtube_dl.utils.PostProcessingError: ffprobe/avprobe and ffmpeg/avconv not found. Please install one.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/Eng-Ahmed Saleh/Desktop/asd/A.py", line 15, in <module>
    ydl.download([input('Youtube link: ')])
  File "C:\Users\Eng-Ahmed Saleh\PycharmProjects\untitled5\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 2008, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "C:\Users\Eng-Ahmed Saleh\PycharmProjects\untitled5\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 807, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "C:\Users\Eng-Ahmed Saleh\PycharmProjects\untitled5\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 861, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "C:\Users\Eng-Ahmed Saleh\PycharmProjects\untitled5\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 1642, in process_video_result
    self.process_info(new_info)
  File "C:\Users\Eng-Ahmed Saleh\PycharmProjects\untitled5\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 1989, in process_info
    self.post_process(filename, info_dict)
  File "C:\Users\Eng-Ahmed Saleh\PycharmProjects\untitled5\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 2056, in post_process
    self.report_error(e.msg)
  File "C:\Users\Eng-Ahmed Saleh\PycharmProjects\untitled5\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 624, in report_error
    self.trouble(error_message, tb)
  File "C:\Users\Eng-Ahmed Saleh\PycharmProjects\untitled5\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 594, in trouble
    raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: ffprobe/avprobe and ffmpeg/avconv not found. Please install one.
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
AhmedSaleh
  • 21
  • 1
  • 6
  • This is probably a silly question, but do you have FFmpeg installed? If so, does using the standalone youtube-dl executable (`youtube-dl -x --audio-format mp3 [url]`) give you the same result, or result in a warning/error message? – Hoppeduppeanut Jul 03 '19 at 01:18
  • 1
    Thanks ! yeah i installed FFmpeg yeah it gives me error i will put it in the question to show the error – AhmedSaleh Jul 03 '19 at 02:22
  • 1
    **i found the answer here** thanks! https://stackoverflow.com/a/42745019/11731360 – AhmedSaleh Jul 03 '19 at 14:30

0 Answers0