From 43c13e5ea23230edca38426d4a9eed049a70890e Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 19 Feb 2020 16:31:04 +0100 Subject: ytdl_hook: add a way to not pass --format to the command line Might be helpful for... whatever. --- DOCS/man/options.rst | 9 +++++++-- player/lua/ytdl_hook.lua | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 5ffc16cf89..f0543c7275 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -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=`` +``--ytdl-format=`` 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==[,=[,...]]`` Pass arbitrary options to youtube-dl. Parameter and argument should be diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index 8822299671..3526d907ea 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -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) -- cgit v1.2.3