Хочу скачать видео с ютуба и конвертировать его в аудио. Для этого использую библиотеку youtube-dl. В моём коде простой пример из
документации . Установленные пакеты: pip install youtube-dl, ffmpeg
from __future__ import unicode_literals
import youtube_dl
import ffmpeg
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '320',
}],
'prefer_ffmpeg': True
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(['https://www.youtube.com/watch?v=BaW_jenozKc'])
Результатом скачивается видео и конвертируется в аудиофайл, но при этом возникает очень много ошибок. Что не так?
WARNING: BaW_jenozKc: writing DASH m4a. Only some players support this container. Install ffmpeg or avconv to fix this automatically.
ERROR: ffprobe/avprobe and ffmpeg/avconv not found. Please install one.
Traceback (most recent call last):
File "C:\Users\Leоnid\PycharmProjects\converter2\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 2115, in post_process
files_to_delete, info = pp.run(info)
File "C:\Users\Leоnid\PycharmProjects\converter2\venv\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 272, in run
filecodec = self.get_audio_codec(path)
File "C:\Users\Leоnid\PycharmProjects\converter2\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\Leоnid\PycharmProjects\converter2\main.py", line 17, in <module>
ydl.download(['https://www.youtube.com/watch?v=BaW_jenozKc'])
File "C:\Users\Leоnid\PycharmProjects\converter2\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 2068, in download
res = self.extract_info(
File "C:\Users\Leоnid\PycharmProjects\converter2\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 808, in extract_info
return self.__extract_info(url, ie, download, extra_info, process)
File "C:\Users\Leоnid\PycharmProjects\converter2\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 815, in wrapper
return func(self, *args, **kwargs)
File "C:\Users\Leоnid\PycharmProjects\converter2\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 847, in __extract_info
return self.process_ie_result(ie_result, download, extra_info)
File "C:\Users\Leоnid\PycharmProjects\converter2\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 881, in process_ie_result
return self.process_video_result(ie_result, download=download)
File "C:\Users\Leоnid\PycharmProjects\converter2\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 1692, in process_video_result
self.process_info(new_info)
File "C:\Users\Leоnid\PycharmProjects\converter2\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 2050, in process_info
self.post_process(filename, info_dict)
File "C:\Users\Leоnid\PycharmProjects\converter2\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 2117, in post_process
self.report_error(e.msg)
File "C:\Users\Leоnid\PycharmProjects\converter2\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 628, in report_error
self.trouble(error_message, tb)
File "C:\Users\Leоnid\PycharmProjects\converter2\venv\lib\site-packages\youtube_dl\YoutubeDL.py", line 598, in trouble
raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: ffprobe/avprobe and ffmpeg/avconv not found. Please install one.