ytdl_hook: add a way to not pass --format to the command line

Might be helpful for... whatever.
This commit is contained in:
wm4 2020-02-19 16:31:04 +01:00
parent b8f80b3854
commit 43c13e5ea2
2 changed files with 12 additions and 4 deletions

View File

@ -837,13 +837,18 @@ Program Behavior
formats like HLS and DASH, if available, allowing for video/audio selection
in runtime. It's disabled ("no") by default for performance reasons.
``--ytdl-format=<best|worst|mp4|webm|...>``
``--ytdl-format=<ytdl|best|worst|mp4|webm|...>``
Video format/quality that is directly passed to youtube-dl. The possible
values are specific to the website and the video, for a given url the
available formats can be found with the command
``youtube-dl --list-formats URL``. See youtube-dl's documentation for
available aliases.
(Default: youtube-dl's default, currently ``bestvideo+bestaudio/best``)
(Default: ``bestvideo+bestaudio/best``)
The ``ytdl`` value does not pass a ``--format`` option to youtube-dl at all,
and thus does not override its default. Note that sometimes youtube-dl
returns a format that mpv cannot use, and in these cases the mpv default
may work better.
``--ytdl-raw-options=<key>=<value>[,<key>=<value>[,...]]``
Pass arbitrary options to youtube-dl. Parameter and argument should be

View File

@ -519,8 +519,11 @@ function run_ytdl_hook(url)
if (format == "") then
format = "bestvideo+bestaudio/best"
end
table.insert(command, "--format")
table.insert(command, format)
if format ~= "ytdl" then
table.insert(command, "--format")
table.insert(command, format)
end
for param, arg in pairs(raw_options) do
table.insert(command, "--" .. param)