mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Add webm to dash manifests
This commit is contained in:
parent
af1823db8c
commit
98295b85ab
1 changed files with 32 additions and 28 deletions
|
@ -4124,16 +4124,17 @@ get "/api/manifest/dash/id/:id" do |env|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
audio_streams = video.audio_streams(adaptive_fmts).select { |stream| stream["type"].starts_with? "audio/mp4" }
|
audio_streams = video.audio_streams(adaptive_fmts)
|
||||||
video_streams = video.video_streams(adaptive_fmts).select { |stream| stream["type"].starts_with? "video/mp4" }.uniq { |stream| stream["size"] }
|
video_streams = video.video_streams(adaptive_fmts)
|
||||||
|
|
||||||
manifest = XML.build(indent: " ", encoding: "UTF-8") do |xml|
|
manifest = XML.build(indent: " ", encoding: "UTF-8") do |xml|
|
||||||
xml.element("MPD", "xmlns": "urn:mpeg:dash:schema:mpd:2011",
|
xml.element("MPD", "xmlns": "urn:mpeg:dash:schema:mpd:2011",
|
||||||
"profiles": "urn:mpeg:dash:profile:isoff-live:2011", minBufferTime: "PT1.5S", type: "static",
|
"profiles": "urn:mpeg:dash:profile:isoff-live:2011", minBufferTime: "PT1.5S", type: "static",
|
||||||
mediaPresentationDuration: "PT#{video.info["length_seconds"]}S") do
|
mediaPresentationDuration: "PT#{video.info["length_seconds"]}S") do
|
||||||
xml.element("Period") do
|
xml.element("Period") do
|
||||||
xml.element("AdaptationSet", mimeType: "audio/mp4", startWithSAP: 1, subsegmentAlignment: true) do
|
{"audio/mp4", "audio/webm"}.each do |mime_type|
|
||||||
audio_streams.each do |fmt|
|
xml.element("AdaptationSet", mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true) do
|
||||||
|
audio_streams.select { |stream| stream["type"].starts_with? mime_type }.each do |fmt|
|
||||||
codecs = fmt["type"].split("codecs=")[1].strip('"')
|
codecs = fmt["type"].split("codecs=")[1].strip('"')
|
||||||
bandwidth = fmt["bitrate"]
|
bandwidth = fmt["bitrate"]
|
||||||
itag = fmt["itag"]
|
itag = fmt["itag"]
|
||||||
|
@ -4149,10 +4150,12 @@ get "/api/manifest/dash/id/:id" do |env|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
xml.element("AdaptationSet", mimeType: "video/mp4", startWithSAP: 1, subsegmentAlignment: true,
|
{"video/mp4", "video/webm"}.each do |mime_type|
|
||||||
|
xml.element("AdaptationSet", mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true,
|
||||||
scanType: "progressive") do
|
scanType: "progressive") do
|
||||||
video_streams.each do |fmt|
|
video_streams.select { |stream| stream["type"].starts_with? mime_type }.each do |fmt|
|
||||||
codecs = fmt["type"].split("codecs=")[1].strip('"')
|
codecs = fmt["type"].split("codecs=")[1].strip('"')
|
||||||
bandwidth = fmt["bitrate"]
|
bandwidth = fmt["bitrate"]
|
||||||
itag = fmt["itag"]
|
itag = fmt["itag"]
|
||||||
|
@ -4172,6 +4175,7 @@ get "/api/manifest/dash/id/:id" do |env|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
manifest = manifest.gsub(%(<?xml version="1.0" encoding="UTF-8U"?>), %(<?xml version="1.0" encoding="UTF-8"?>))
|
manifest = manifest.gsub(%(<?xml version="1.0" encoding="UTF-8U"?>), %(<?xml version="1.0" encoding="UTF-8"?>))
|
||||||
manifest = manifest.gsub(%(<?xml version="1.0" encoding="UTF-8V"?>), %(<?xml version="1.0" encoding="UTF-8"?>))
|
manifest = manifest.gsub(%(<?xml version="1.0" encoding="UTF-8V"?>), %(<?xml version="1.0" encoding="UTF-8"?>))
|
||||||
|
|
Loading…
Reference in a new issue