Reputation: 31
I am using the latest version of yt-dlp
with Python 3.9.
I am trying to download a youtube video in mp4 format with outputname as the youtubeid.mp4
and with best resolution not more than 4K.
This is my Python code:
ytid = '4cDqaLxrt6Q'
url = 'https://www.youtube.com/watch?v='+ytid
output_filename = ytid+".mp4"
with YoutubeDL({'format': 'bestvideo[height<=?4K]+bestaudio/best', 'output': output_filename}) as ydl:
ydl.download(url)`#TODO debug FFmpeg and check if outputname is ok
I expected to have an .mp4
file in my current working directory.
Then I installed the latest version of FFmpeg
from ffmpeg-master-latest-win64-gpl.zip
and put ffmpeg.exe
, ffplay.exe
and ffprobe.exe
in Scripts python folder (where yt-dlp.exe
is). I also installed ffmpeg
using pip install
.
The Traceback
is:
[youtube] Extracting URL: https://www.youtube.com/watch?v=4cDqaLxrt6Q [youtube] 4cDqaLxrt6Q: Downloading webpage [youtube] 4cDqaLxrt6Q: Downloading android player API JSON [youtube] 4cDqaLxrt6Q: Downloading MPD manifest [youtube] 4cDqaLxrt6Q: Downloading MPD manifest [info] 4cDqaLxrt6Q: Downloading 1 format(s): 243+251 ERROR: You have requested merging of multiple formats but ffmpeg is not installed. Aborting due to --abort-on-error Traceback (most recent call last):
File "C:\Users\t\OneDrive\Documents\Python Scripts\project\main.py", line 88, in ydl.download(url)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 3353, in download self.__download_wrapper(self.extract_info)(
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 3328, in wrapper res = func(*args, **kwargs)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 1486, in extract_info return self.__extract_info(url, self.get_info_extractor(key), download, extra_info, process)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 1497, in wrapper return func(self, *args, **kwargs)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 1594, in __extract_info return self.process_ie_result(ie_result, download, extra_info)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 1653, in process_ie_result ie_result = self.process_video_result(ie_result, download=download)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 2767, in process_video_result self.process_info(new_info)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 3189, in process_info self.report_error(f'{msg}. Aborting due to --abort-on-error')
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 1007, in report_error self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 947, in trouble raise DownloadError(message, exc_info)
DownloadError: ERROR: You have requested merging of multiple formats but ffmpeg is not installed. Aborting due to --abort-on-error
Upvotes: 3
Views: 11720
Reputation: 35
If you are using conda
as your Python package manager, you can install ffmpeg
in the virtual environment.
Note that the conda
method is different from the pip
method you mentioned.
(base) C:\Users\user> conda install ffmpeg
See: https://stackoverflow.com/a/75270671/22124527
I have installed last release of FFmpeg from ffmpeg-master-latest-win64-gpl.zip and put ffmpeg.exe , ffplay.exe and ffprobe.exe in Scripts python folder.
"Put .exe
in the same python script folder" does not implies "add .exe
in the system path that python can find".
You can try:
import sys
sys.path.append('/path/to/your/exe/file/location')
Upvotes: 2
Reputation: 1322
You have two ways:
$Env:Path
Upvotes: 0