yt-dlp / yt-dlp

A feature-rich command-line audio/video downloader
https://discord.gg/H5MNcFW63r
The Unlicense
82.35k stars 6.42k forks source link

PIP install FFmpeg usage #5521

Closed crumhirnd closed 1 year ago

crumhirnd commented 1 year ago

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

Checklist

Please make sure the question is worded well enough to be understood

How do you get FFmpeg to work when installing via PIP?

I used pip install ffmpeg and pip install yt-dlp.

After that, I used the command yt-dlp https://www.youtube.com/watch?v=CV9LyYzLUyQ --recode-video mp4 --add-metadata --embed-thumbnail

It says "ffmpeg not found."

Provide verbose output that clearly demonstrates the problem

Complete Verbose Output

[debug] Command-line config: ['-vU', 'https://www.youtube.com/watch?v=CV9LyYzLUyQ', '--recode-video', 'mp4', '--add-metadata', '--embed-thumbnail']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.11.11 [8b64402] (pip)
[debug] Python 3.10.6 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1n  15 Mar 2022)
[debug] exe versions: none
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.09.24, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1723 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: 2022.11.11, Current version: 2022.11.11
yt-dlp is up to date (2022.11.11)
[debug] [youtube] Extracting URL: https://www.youtube.com/watch?v=CV9LyYzLUyQ
[youtube] CV9LyYzLUyQ: Downloading webpage
[youtube] CV9LyYzLUyQ: Downloading android player API JSON
[debug] Loading youtube-nsig.c4225c42 from cache
[debug] [youtube] Decrypted nsig A0urRDbEPfihEBUxPJ- => 1LSiyb7DYPi-rg
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, hasaud, id
[debug] Default format spec: best/bestvideo+bestaudio
[info] CV9LyYzLUyQ: Downloading 1 format(s): 22
Deleting existing file Devil May Cry 5: The Dante Dance [CV9LyYzLUyQ].webp
[info] Downloading video thumbnail 41 ...
[info] Writing video thumbnail 41 to: Devil May Cry 5: The Dante Dance [CV9LyYzLUyQ].webp
[debug] Invoking http downloader on "https://rr5---sn-v2u0n-hxar.googlevideo.com/videoplayback?expire=1668358067&ei=U8twY-aJHNG99QOnpYGQBw&ip=175.39.188.101&id=o-AFzSH_4aXR22szKuYG9hiMjgVXJLNXMfhiewm-3dFeBl&itag=22&source=youtube&requiressl=yes&mh=9r&mm=31%2C29&mn=sn-v2u0n-hxar%2Csn-v2u0n-ntqd&ms=au%2Crdu&mv=m&mvi=5&pcm2cms=yes&pl=20&initcwndbps=1441250&spc=SFxXNnX0GjBoTKXwX1LuPqMbf1V9iuM&vprv=1&svpuc=1&mime=video%2Fmp4&ratebypass=yes&dur=47.066&lmt=1614766782153875&mt=1668336088&fvip=6&fexp=24001373%2C24007246&c=ANDROID&txp=1432434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cratebypass%2Cdur%2Clmt&sig=AOq0QJ8wRQIgavipGQ37xBZbCTz6PKYdFwfJ2-jSyJ5XP0a0Vk68_eMCIQDM1oLy09CZs51r3BIJs7LZO2vSzzq8zIKtKrl3Mqq0ew%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAOecq0wZKaFBnrP-WQZI8BQA80kuS7-BOUJmT5JKUUZDAiEArWsvx2eNCaLYgY8K55nOh6OxFpTUFXo7bVq-O10E3Bs%3D"
[download] Devil May Cry 5: The Dante Dance [CV9LyYzLUyQ].mp4 has already been downloaded
[download] 100% of   14.09MiB
[VideoConvertor] Not converting media file "Devil May Cry 5: The Dante Dance [CV9LyYzLUyQ].mp4"; already is in target format mp4
[Metadata] Adding metadata to "Devil May Cry 5: The Dante Dance [CV9LyYzLUyQ].mp4"
ERROR: Postprocessing: ffmpeg not found. Please install or provide the path using --ffmpeg-location
Traceback (most recent call last):
  File "C:\Users\onelu\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\YoutubeDL.py", line 3276, in process_info
    replace_info_dict(self.post_process(dl_filename, info_dict, files_to_move))
  File "C:\Users\onelu\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\YoutubeDL.py", line 3453, in post_process
    info = self.run_all_pps('post_process', info, additional_pps=info.get('__postprocessors'))
  File "C:\Users\onelu\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\YoutubeDL.py", line 3435, in run_all_pps
    info = self.run_pp(pp, info)
  File "C:\Users\onelu\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\YoutubeDL.py", line 3414, in run_pp
    files_to_delete, infodict = pp.run(infodict)
  File "C:\Users\onelu\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\postprocessor\common.py", line 24, in run
    ret = func(self, info, *args, **kwargs)
  File "C:\Users\onelu\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\postprocessor\common.py", line 129, in wrapper
    return func(self, info)
  File "C:\Users\onelu\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\postprocessor\ffmpeg.py", line 702, in run
    self.run_ffmpeg_multiple_files(
  File "C:\Users\onelu\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\postprocessor\ffmpeg.py", line 323, in run_ffmpeg_multiple_files
    return self.real_run_ffmpeg(
  File "C:\Users\onelu\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\postprocessor\ffmpeg.py", line 328, in real_run_ffmpeg
    self.check_version()
  File "C:\Users\onelu\AppData\Local\Programs\Python\Python310\lib\site-packages\yt_dlp\postprocessor\ffmpeg.py", line 231, in check_version
    raise FFmpegPostProcessorError('ffmpeg not found. Please install or provide the path using --ffmpeg-location')
yt_dlp.postprocessor.ffmpeg.FFmpegPostProcessorError: ffmpeg not found. Please install or provide the path using --ffmpeg-location
bashonly commented 1 year ago

Don't install ffmpeg with PIP. ffmpeg is not a python package. Whatever you installed with PIP is not the actual ffmpeg. I suggest uninstalling it, and then getting an ffmpeg build from one of these repos:

https://github.com/BtbN/FFmpeg-Builds

https://github.com/yt-dlp/FFmpeg-Builds#ffmpeg-static-auto-builds

crumhirnd commented 1 year ago

How would I install it into the yt-dlp I installed through pip?

On Sun, 13 Nov 2022, 23:11 bashonly, @.***> wrote:

Don't install ffmpeg with PIP. ffmpeg is not a python package. Whatever you installed with PIP is not the actual ffmpeg. I suggest uninstalling it, and then getting an ffmpeg build from one of these repos:

https://github.com/BtbN/FFmpeg-Builds

https://github.com/yt-dlp/FFmpeg-Builds#ffmpeg-static-auto-builds

— Reply to this email directly, view it on GitHub https://github.com/yt-dlp/yt-dlp/issues/5521#issuecomment-1312715728, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT3KSN6AZ32GCB6X6TCANITWIDLG3ANCNFSM6AAAAAAR65Y6Q4 . You are receiving this because you authored the thread.Message ID: @.***>

flashdagger commented 1 year ago

ffmpeg is a misleading package, that only provides an API wrapper. There is also static-ffmpeg which installs the binaries into your Python environment.

But you still have to setup the paths, so yt-dlp will find it.

crumhirnd commented 1 year ago

how would I do that?

flashdagger commented 1 year ago

After installation print out the paths (example):

> static_ffmpeg_paths
FFMPEG=c:\users\niteris\dev\static_ffmpeg\static_ffmpeg\bin\win32\ffmpeg.exe
FFPROBE=c:\users\niteris\dev\static_ffmpeg\static_ffmpeg\bin\win32\ffprobe.exe

Then you can add it to the PATH variable (without the .exe file) set PATH="%PATH%;c:\users\niteris\dev\static_ffmpeg\static_ffmpeg\bin\win32\" Or you use the yt-dlp --ffmpeg-location <path> ...

crumhirnd commented 1 year ago

how do I print the paths?

flashdagger commented 1 year ago

After installation you execute static_ffmpeg_paths.exe

crumhirnd commented 1 year ago

I tried set PATH="%PATH%;C:\Users\onelu\AppData\Local\Programs\Python\Python310\lib\site-packages\static_ffmpeg\bin\win32\" but it still doesn't work.

flashdagger commented 1 year ago

Which console are you using? cmd or powershell?

crumhirnd commented 1 year ago

cmd, should I use powershell?

I tried adding to user environment variables, also not working.

flashdagger commented 1 year ago

Cmd is fine. I think the double quotes are wrong. Restart cmd and try again without the quotes: set PATH=%PATH%;C:\Users\onelu\AppData\Local\Programs\Python\Python310\lib\site-packages\static_ffmpeg\bin\win32\

You can then quickly check with where ffmpeg

crumhirnd commented 1 year ago

ok, it works now! thanks for the help. also could y'all add this to the readme? unless its already there (i ctrl+f'ed before asking here)

flashdagger commented 1 year ago

It's an actually an OS related issue and depends on the knowledge and preference of the user, since there are many ways to have ffmpeg installed.

Maybe the documentation should point out that pip install ffmpeg is misleading...

crumhirnd commented 1 year ago

For beginner users like me I think it would be helpful to have this information in the installation guide.

On Mon, 14 Nov 2022, 00:22 MMM, @.***> wrote:

It's an actually an OS related issue and depends on the knowledge and preference of the user, since there are many ways to have ffmpeg installed.

Maybe the documentation should point out that pip install ffmpeg is misleading...

— Reply to this email directly, view it on GitHub https://github.com/yt-dlp/yt-dlp/issues/5521#issuecomment-1312729579, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT3KSN4D44AM4FWAQ2IEPFLWIDTRJANCNFSM6AAAAAAR65Y6Q4 . You are receiving this because you authored the thread.Message ID: @.***>

pukkandan commented 1 year ago

The documentation already links to ffmpeg's webpage as well as to the custom builds, and not to the PiP package. There is nothing in the docs that suggests that pip install ffmpeg is correct

If you want to add more detailed noob-friendly instructions for installing yt-dlp + dependencies, feel free to make a PR against https://github.com/yt-dlp/yt-dlp-wiki instead