mpv: patch to fix yt-dlp fragments

This commit is contained in:
eljamm 2023-03-04 12:52:11 +01:00 committed by Michal Vasilek
parent 46829f7f15
commit e79bc74ffb
3 changed files with 64 additions and 1 deletions

View file

@ -0,0 +1,26 @@
From 94c189dae76ba280d9883b16346c3dfb9720687e Mon Sep 17 00:00:00 2001
From: Christoph Heinrich <christoph.heinrich@student.tugraz.at>
Date: Fri, 3 Mar 2023 00:45:45 +0100
Subject: [PATCH] ytdl_hook: init fragment requires other fragments
With dash the first fragment was always considered an init fragment if
there wasn't a duration. However that only makes sense when there are
also other fragments, so check if there are other fragments in addition
to the lack of a duration.
---
player/lua/ytdl_hook.lua | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index 27e5f4544b2..9e50b3a80b8 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -297,7 +297,7 @@ local function edl_track_joined(fragments, protocol, is_live, base)
local args = ""
-- assume MP4 DASH initialization segment
- if not fragments[1].duration then
+ if not fragments[1].duration and #fragments > 1 then
msg.debug("Using init segment")
args = args .. ",init=" .. edl_escape(join_url(base, fragments[1]))
offset = 2

View file

@ -0,0 +1,37 @@
From 362256edbc4f95c63e69c1fa8c8dce9cc6c44288 Mon Sep 17 00:00:00 2001
From: Christoph Heinrich <christoph.heinrich@student.tugraz.at>
Date: Fri, 3 Mar 2023 00:50:58 +0100
Subject: [PATCH] ytdl_hook: only log error when no fallback url available
An error indicates that something doesn't work, but as long as a
safe url is available, playback is still expected to work.
Thus reduce logging level of MP4 DASH without fragments message and
add a new error message for when there is no safe url available either.
Also adds a missing space.
---
player/lua/ytdl_hook.lua | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index 9e50b3a80b8..77f7446ed22 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -309,7 +309,7 @@ local function edl_track_joined(fragments, protocol, is_live, base)
-- if not available in all, give up.
for i = offset, #fragments do
if not fragments[i].duration then
- msg.error("EDL doesn't support fragments" ..
+ msg.verbose("EDL doesn't support fragments " ..
"without duration with MP4 DASH")
return nil
end
@@ -423,6 +423,7 @@ local function formats_to_edl(json, formats, use_all_formats)
track.protocol, json.is_live,
track.fragment_base_url)
if not edl_track and not url_is_safe(track.url) then
+ msg.error("No safe URL or supported fragmented stream available")
return nil
end

View file

@ -1,7 +1,7 @@
# Template file for 'mpv'
pkgname=mpv
version=0.35.1
revision=1
revision=2
build_style=meson
configure_args="-Dcdda=enabled -Ddvbin=enabled -Ddvdnav=enabled
-Dlibmpv=true -Dcplugins=enabled