Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
[Youtube] youtube-dl fails to retrieve the hls manifest for livestreams #15202
Comments
|
I am experiencing the same problem. |
|
Same here. Also have the issue with this streams: https://youtube.com/channel/UCba3hpU7EFBSk817y9qZkiA/live but not with this one: https://youtu.be/9h6Vz6ylIdE which surprisingly allows me to seek back in time but I can obtain the |
|
This stream (https://youtu.be/9h6Vz6ylIdE) and the NASA one mentioned above have been active since before this change by YouTube. If you Further - it appears that on the browser, when clicking the nerd stats, there is no longer the line that indicates if it's a DASH stream or not, seemingly confirming that it's just all DASH now. It's not overly surprising given that HLS streams were 30fps irrespective of what went in - every stream had to be converted for archive and this had long been just a compatibility feature. Perhaps what is needed is to change this to a feature request; simply for youtube-dl to support dynamic MPD manifests (it already fully supports static ones) I know from manual debugging, and lots of As a sidenote - same deal for |
|
Yeah I started seeing this error yesterday. I have a script that grabs the link through youtube-dl and feeds it to ffmpeg (using the -live_start_index option to be able to start at the designated time, not sure if this is possible to do with just youtube-dl) and using |
|
One way to deal with the
list.txt will look like this;
Then you can play it;
Now instead of |
|
I'm only inetersted in the link pointing at the dash manifest, but the If nobody else is on it i can find out how to retrieve this url. |
|
The live dash manifest URL is in the player config JSON.
Or extract it yourself:
|
|
Apparently Youtube still has HLS for live streams: youtube-dl -j https://www.youtube.com/watch?v=xAE4xX8Izvo youtube-dl --print-traffic https://www.youtube.com/watch?v=xAE4xX8Izvo BUT "hlsvp":"https://manifest.googlevideo.com/api/manifest/hls_variant/gcr....m3u8 |
|
The HLS playlist was previously accessible in more extraction points and query strings which were favored by In my opinion all live feeds should be returned; it's actually nice to see 50p or 60p videos stream at their ingested frame rate. |
|
A quick and dirty patch for HLS: diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 0919bef0e..9ad662777 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -1537,7 +1537,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
ytplayer_config = self._get_ytplayer_config(video_id, video_webpage)
if ytplayer_config:
args = ytplayer_config['args']
- if args.get('url_encoded_fmt_stream_map'):
+ if args.get('url_encoded_fmt_stream_map') or args.get('hlsvp'):
# Convert to the same format returned by compat_parse_qs
video_info = dict((k, [v]) for k, v in args.items())
add_dash_mpd(video_info)
@@ -1802,15 +1802,16 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
chapters = self._extract_chapters(description_original, video_duration)
+ formats = []
if 'conn' in video_info and video_info['conn'][0].startswith('rtmp'):
self.report_rtmp_download()
- formats = [{
+ formats.append({
'format_id': '_rtmp',
'protocol': 'rtmp',
'url': video_info['conn'][0],
'player_url': player_url,
- }]
- elif len(video_info.get('url_encoded_fmt_stream_map', [''])[0]) >= 1 or len(video_info.get('adaptive_fmts', [''])[0]) >= 1:
+ })
+ if len(video_info.get('url_encoded_fmt_stream_map', [''])[0]) >= 1 or len(video_info.get('adaptive_fmts', [''])[0]) >= 1:
encoded_url_map = video_info.get('url_encoded_fmt_stream_map', [''])[0] + ',' + video_info.get('adaptive_fmts', [''])[0]
if 'rtmpe%3Dyes' in encoded_url_map:
raise ExtractorError('rtmpe downloads are not supported, see https://github.com/rg3/youtube-dl/issues/343 for more information.', expected=True)
@@ -1827,7 +1828,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'width': int_or_none(width_height[0]),
'height': int_or_none(width_height[1]),
}
- formats = []
for url_data_str in encoded_url_map.split(','):
url_data = compat_parse_qs(url_data_str)
if 'itag' not in url_data or 'url' not in url_data:
@@ -1934,9 +1934,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
if codecs:
dct.update(parse_codecs(codecs))
formats.append(dct)
- elif video_info.get('hlsvp'):
+ if video_info.get('hlsvp'):
manifest_url = video_info['hlsvp'][0]
- formats = []
m3u8_formats = self._extract_m3u8_formats(
manifest_url, video_id, 'mp4', fatal=False)
for a_format in m3u8_formats:
@@ -1952,7 +1951,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
# Accept-Encoding header causes failures in live streams on Youtube and Youtube Gaming
a_format.setdefault('http_headers', {})['Youtubedl-no-compression'] = 'True'
formats.append(a_format)
- else:
+ if not formats:
unavailable_message = self._html_search_regex(
r'(?s)<h1[^>]+id="unavailable-message"[^>]*>(.+?)</h1>',
video_webpage, 'unavailable message', default=None) |
|
Thanks @yan12125. In addition to changing the default stream map, it looks like YouTube no longer converts to 30p for HLS. For the sake of completeness, can I suggest on top of your patch: --- a/youtube_dl/extractor/youtube.py 2018-01-12 22:41:11.845928145 +0800
+++ b/youtube_dl/extractor/youtube.py 2018-01-12 22:39:32.695954749 +0800
@@ -401,6 +401,8 @@
'94': {'ext': 'mp4', 'height': 480, 'format_note': 'HLS', 'acodec': 'aac', 'abr': 128, 'vcodec': 'h264', 'preference': -10},
'95': {'ext': 'mp4', 'height': 720, 'format_note': 'HLS', 'acodec': 'aac', 'abr': 256, 'vcodec': 'h264', 'preference': -10},
'96': {'ext': 'mp4', 'height': 1080, 'format_note': 'HLS', 'acodec': 'aac', 'abr': 256, 'vcodec': 'h264', 'preference': -10},
+ '300': {'ext': 'mp4', 'height': 720, 'format_note': 'HLS', 'acodec': 'aac', 'abr': 256, 'vcodec': 'h264', 'preference': -10, 'fps': 60},
+ '301': {'ext': 'mp4', 'height': 1080, 'format_note': 'HLS', 'acodec': 'aac', 'abr': 256, 'vcodec': 'h264', 'preference': -10, 'fps': 60},
'132': {'ext': 'mp4', 'height': 240, 'format_note': 'HLS', 'acodec': 'aac', 'abr': 48, 'vcodec': 'h264', 'preference': -10},
'151': {'ext': 'mp4', 'height': 72, 'format_note': 'HLS', 'acodec': 'aac', 'abr': 24, 'vcodec': 'h264', 'preference': -10},To uniformly represent the stream list in the
Yielding a clear:
|
|
Any idea on when the patch for this will be pushed to the repo? Thanks, btw |
|
hls playlist freezing on vlc and ffmpeg any idea ? |
|
Latest FFmpeg builds seem to work ok on those HLS streams; last stable release on Zeranoe indeed freezes |
|
@vokot both freezing :( |
|
@m0hamedessam I tried with Euronews live https://m.youtube.com/watch?v=xAE4xX8Izvo , new YouTube-dl and latest build https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20180112-1eb7c1d-win64-static.zip - seems to be ok |
|
@vkot i use this command and freeze can you send me yours |
|
@m0hamedessam Just copy-pasted your command, runs smooth, no freeze. Are you sure you have both ffmpeg and ffplay from the latest build? No other ffmpeg binaries in the PATH? |
|
Strange. Let’s see what other people will report on that other ticket. |
Where is the player config JSON? |
The way to retrieve the hls manifest for youtube livestreams changed.
See @yan12125 s comment below for fix.
Original: