summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2017-02-10 19:43:32 +0000
committerRicardo Constantino <wiiaboo@gmail.com>2017-02-10 20:24:03 +0000
commit6ac3d77e908b9398f9f8c9b8be15a33be4ee67ea (patch)
tree5e6c24bc36010655fd9d275fbed512c106adebf9 /player
parentd0f1d382e61d9cb9a2eb868d9464c97ecaf963da (diff)
downloadmpv-6ac3d77e908b9398f9f8c9b8be15a33be4ee67ea.tar.bz2
mpv-6ac3d77e908b9398f9f8c9b8be15a33be4ee67ea.tar.xz
ytdl_hook: support livestream segmented DASH VODs
Seen with a VOD of a recently ended livestream on Youtube. They seem to use segmented DASH but unlike normal Youtube segmented DASH, the segments don't seem to need the initialization segment. The video actually fails to start to play if the init segment is prepended with a lot of 'Found duplicated MOOV Atom. Skipped it' errors popping up.
Diffstat (limited to 'player')
-rw-r--r--player/lua/ytdl_hook.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index 0a55ddb93b..d53a2ae4c1 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -88,7 +88,7 @@ local function extract_chapters(data, video_length)
return ret
end
-local function edl_track_joined(fragments, protocol)
+local function edl_track_joined(fragments, protocol, is_live)
if not (type(fragments) == "table") or not fragments[1] then
msg.debug("No fragments to join into EDL")
return nil
@@ -98,7 +98,7 @@ local function edl_track_joined(fragments, protocol)
local offset = 1
if (protocol == "http_dash_segments") and
- not fragments[1].duration then
+ not fragments[1].duration and not is_live then
-- assume MP4 DASH initialization segment
edl = edl .. "!mp4_dash,init=" .. edl_escape(fragments[1].url) .. ";"
offset = 2
@@ -303,7 +303,8 @@ mp.add_hook("on_load", 10, function ()
if not (json["requested_formats"] == nil) then
for _, track in pairs(json.requested_formats) do
local edl_track = nil
- edl_track = edl_track_joined(track.fragments,track.protocol)
+ edl_track = edl_track_joined(track.fragments,
+ track.protocol, json.is_live)
if track.acodec and track.acodec ~= "none" then
-- audio track
mp.commandv("audio-add",
@@ -317,7 +318,8 @@ mp.add_hook("on_load", 10, function ()
elseif not (json.url == nil) then
local edl_track = nil
- edl_track = edl_track_joined(json.fragments, json.protocol)
+ edl_track = edl_track_joined(json.fragments, json.protocol,
+ json.is_live)
-- normal video or single track
streamurl = edl_track or json.url