From 78caf6ae8634b9fe9589187d8febb927dce2ddeb Mon Sep 17 00:00:00 2001 From: ChrisK2 Date: Sun, 11 Oct 2015 00:35:35 +0200 Subject: ytdl: Remove DASH hacks, use DASH by default Thanks to rcombs, ffmpeg now properly supports DASH and we can remove our hacks for it and use it by default whenever available. If you don't like this for whatever reason, you can get the "normal" streams back with --ytdl-format=best . Closes #579 Closes #1321 Closes #2359 --- player/lua/ytdl_hook.lua | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'player/lua/ytdl_hook.lua') diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index 66ab85159b..d43a7bb35e 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -2,7 +2,8 @@ local utils = require 'mp.utils' local msg = require 'mp.msg' local ytdl = { - path = "youtube-dl" + path = "youtube-dl", + searched = false } local function exec(args) @@ -60,6 +61,16 @@ mp.add_hook("on_load", 10, function () if (url:find("http://") == 1) or (url:find("https://") == 1) or (url:find("ytdl://") == 1) then + -- check for youtube-dl in mpv's config dir + if not (ytdl.searched) then + local ytdl_mcd = mp.find_config_file("youtube-dl") + if not (ytdl_mcd == nil) then + msg.verbose("found youtube-dl at: " .. ytdl_mcd) + ytdl.path = ytdl_mcd + end + ytdl.searched = true + end + -- strip ytdl:// if (url:find("ytdl://") == 1) then url = url:sub(8) @@ -183,19 +194,10 @@ mp.add_hook("on_load", 10, function () -- video url streamurl = json["requested_formats"][1].url - if (json["ext"] == "mp4") and not (json.duration == nil) then - msg.info("Using DASH, expect inaccurate duration.") - msg.info("Actual duration: "..mp.format_time(json.duration)) - end - -- audio url mp.set_property("file-local-options/audio-file", json["requested_formats"][2].url) - -- workaround for slow startup (causes inaccurate duration) - mp.set_property("file-local-options/demuxer-lavf-o", - "fflags=+ignidx") - elseif not (json.url == nil) then -- normal video streamurl = json.url -- cgit v1.2.3