-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Use youtube dl with IINA
IINA added support for youtube-dl since v0.0.5.
youtube-dl is a command-line program to download videos from YouTube.com and a few more sites.
It enables media streaming from any supported site, therefore you can enjoy almost all features in IINA.
The mechanism
IINA uses mpv's mechanism directly: A ytdl_hook.lua script will be executed before loading a media. The script will search youtube-dl executable in PATH
and try to call it.
How to use youtube-dl
- Enable youtube-dl in
Preference > Network > Youtube-dl
(it's enabled by default). - Open an URL in any way, for example:
Use your own binary
Youtube-dl updates very fast. IINA will try to include the latest version at each release, but won't catch up its pace in most situations. So you can use your custom youtube-dl binary if the shipped one failed due to old version. To install the latest youtube-dl, use homebrew:
brew install youtube-dl
You can get youtube-dl's path by running
which youtube-dl
And then set Custom youtube-dl path
to the path to youtube-dl executable in Preference. Please don't include youtube-dl
itself in the path. For a typical homebrew installation, you should fill in:
on Intel:
/usr/local/bin
on Apple Silicon (M1/M2/M3):
/opt/homebrew
IINA just prepends this path to PATH
at runtime and will not do any check. Hence, it's theoretically possible to write other lua scripts which calls other executables in this path.
For advanced users: please note that since /usr/local/bin
(or whatever you set) takes priority, youtube-dl
will now use the python interpreter installed by Homebrew (if any), which might be a different environment from what you have in your shell normally. If you encountered problem after setting this path, you can try reproduce the problem in the shell by prepending /usr/local/bin/
to your PATH
and run youtube-dl
. In most cases, a reinstallation should resolve the problem.
Can I download the video?
IINA (mpv) doesn't support downloading. Please use youtube-dl directly to download videos and refer to their documentation.
You can set custom options for youtube-dl in Preference > Network > Youtube-dl
. The option will be passed directly to mpv's ytdl-raw-options
option, so you should handle the escaping of spaces and other characters on your own.
If you want to limit quality of youtube videos (example: 720p, 480p, etc) you can use this recipe This is very useful if you don't want to stream full quality(for example: 4K video)
It's possible to set proxy in youtube-dl custom option, however, it will only work when getting the real video address. The recommended solution is setting HTTP proxy in Preference > Network > Network
instead, which works for both youtube-dl and normal playback (i.e. FFmpeg). The proxy value will be set to environment variable http_proxy
, and of course, only http proxies are supported.