chrippa / livestreamer

Command-line utility that extracts streams from various services and pipes them into a video player of choice. No longer maintained, use streamlink or youtube-dl instead.
http://livestreamer.io/
BSD 2-Clause "Simplified" License
3.88k stars 582 forks source link

Livestreamer can't find the best resolution of this livestream #1542

Open baptx opened 7 years ago

baptx commented 7 years ago

Livestreamer can't find the best resolution of this livestream: http://nrj-apple-live.adaptive.level3.net/apple/nrj/nrjcheriehd/cherie25.m3u8 It plays a very poor quality compared to what youtube-dl and mpv finds by default. This livestream is ok: http://nrj-apple-live.adaptive.level3.net/apple/nrj/nrj/nrj12.m3u8

scottbernstein-zz commented 7 years ago

hey @baptx:

2 things:

  1. that "...cherie25.m3u8" URL gives me a "403 client error: Forbidden" error so I am unable to look into exactly what's causing the issue.
  2. Have you ever tried using the "name_key=bitrate" option? My guess is that will help here. This option helps out when there are multiple bit rates for the same resolution (there could indeed be many bitrate options available, for example, all at 720p resolution) -- some of them may be MUCH higher quality than others.

In your case, you would use the option like this:

livestreamer "hlsvariant://http://nrj-apple-live.adaptive.level3.net/apple/nrj/nrjcheriehd/cherie25.m3u8 name_key=bitrate" best ....etc

Best,

Scott


From: baptx notifications@github.com Sent: Monday, November 14, 2016 4:52:44 PM To: chrippa/livestreamer Subject: [chrippa/livestreamer] Livestreamer can't find the best resolution of this livestream (#1542)

Livestreamer can't find the best resolution of this livestream: http://nrj-apple-live.adaptive.level3.net/apple/nrj/nrjcheriehd/cherie25.m3u8 It plays a very poor quality compared to what mpv finds by default. This livestream is ok: http://nrj-apple-live.adaptive.level3.net/apple/nrj/nrj/nrj12.m3u8

You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/chrippa/livestreamer/issues/1542, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AESJ1mBZoTYzUvcKwyvOuhn3YvjMjbBJks5q-NgsgaJpZM4Kx2xy.

Vangelis66 commented 7 years ago

Salut @baptx

Both master HLS playlists you reference are geo-blocked for non-French IPs; I've managed to find a working French http proxy to conduct some tests; with regards to the second one (NRJ12), this is what I get:

livestreamer -l debug --http-proxy "163.172.184.xxx:3128" "hlsvariant://nrj-apple-live.adaptive.level3.net/apple/nrj/nrj/nrj12.m3u8" =>

[cli][info] Found matching plugin stream for URL hlsvariant://nrj-apple-live.ada
ptive.level3.net/apple/nrj/nrj/nrj12.m3u8
Available streams: 40k (worst), 188k, 306k, 657k, 857k (best)

So the best live stream here is 857k (bitrate)

On the contrary,

livestreamer -l debug --http-proxy "163.172.184.xxx:3128" "hlsvariant://nrj-apple-live.adaptive.level3.net/apple/nrj/nrjcheriehd/cherie25.m3u8" =>

[cli][info] Found matching plugin stream for URL hlsvariant://nrj-apple-live.ada
ptive.level3.net/apple/nrj/nrjcheriehd/cherie25.m3u8
Available streams: 198p (worst), 360p, 406p (best)

it looks as though the highest quality offered in this stream is 406p (this is resolution, not bitrate like in the NRJ12 case). My proxy is too weak to allow for stream downloading, however I managed to get the playlist itself via browser; its contents read:

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=233376,RESOLUTION=720x406,CODECS="mp4a.40.5,avc1.42801e"
cherie25low.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=491632,RESOLUTION=640x360,CODECS="mp4a.40.5,avc1.42801e"
cherie25med.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=812144,RESOLUTION=352x198,CODECS="mp4a.40.5,avc1.42801e"
cherie25hi.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000,RESOLUTION=352x198,CODECS="mp4a.40.5,avc1.42801e"
cherie25lowaudio.m3u8

As you can see for yourself, the highest resolution stream (720x406=406p) does not correspond to the highest bitrate (BANDWIDTH); that one (812144) corresponds to the stream with only 198p resolution; probably the Cherie25 people have screwed things up...

If you are after the stream with best bitrate rather than best resolution, then perhaps use the relative playlist of that stream and issue something like:

livestreamer "hls://nrj-apple-live.adaptive.level3.net/apple/nrj/nrjcheriehd/cherie25hi.m3u8" best

EDIT: I just found a better French proxy and actually downloaded 15MB worth of that quality variant; excellent news! It isn't 352x198 as suggested by the playlist, but actually:

Video: H.264/AVC 720x406 25fps [V: h264 baseline L3.0, yuv420p, 720x406]
Audio: AAC 44100Hz stereo 59kbps [A: English [eng] (aac he-aacv2, 44100 Hz, stereo, 59 kb/s)]

Have fun!

EDIT2: Actually, @scottbernstein's suggestion also works: livestreamer --http-proxy "163.172.xxx.xxx:3128" -o "cherie25_live.ts" "hlsvariant://http://nrj-apple-live.adaptive.level3.net/apple/nrj/nrjcheriehd/cherie25.m3u8 name_key=bitrate" best =>

[cli][info] Found matching plugin stream for URL hlsvariant://http://nrj-apple-l
ive.adaptive.level3.net/apple/nrj/nrjcheriehd/cherie25.m3u8 name_key=bitrate
[cli][info] Available streams: 64k (worst), 233k, 491k, 812k (best)
[cli][info] Opening stream: 812k (hls)
scottbernstein-zz commented 7 years ago

Even given the work that @vangelis66 did here, I would point out that using the name_key=bitrate option would have yielded the same result!

Best,

Scott


From: Vangelis66 notifications@github.com Sent: Monday, November 14, 2016 8:52:06 PM To: chrippa/livestreamer Cc: scottbernstein; Comment Subject: Re: [chrippa/livestreamer] Livestreamer can't find the best resolution of this livestream (#1542)

Salut @baptxhttps://github.com/baptx

Both master HLS playlists you reference are geo-blocked for non-French IPs; I've managed to find a working French http proxy to conduct some tests; with regards to the second one (NRJ12), this is what I get:

livestreamer -l debug --http-proxy "163.172.184.xxx:3128" "hlsvariant://nrj-apple-live.adaptive.level3.net/apple/nrj/nrj/nrj12.m3u8" =>

[cli][info] Found matching plugin stream for URL hlsvariant://nrj-apple-live.ada ptive.level3.net/apple/nrj/nrj/nrj12.m3u8 Available streams: 40k (worst), 188k, 306k, 657k, 857k (best)

So the best live stream here is 857k (bitrate)

On the contrary,

livestreamer -l debug --http-proxy "163.172.184.xxx:3128" "hlsvariant://nrj-apple-live.adaptive.level3.net/apple/nrj/nrjcheriehd/cherie25.m3u8" =>

[cli][info] Found matching plugin stream for URL hlsvariant://nrj-apple-live.ada ptive.level3.net/apple/nrj/nrjcheriehd/cherie25.m3u8 Available streams: 198p (worst), 360p, 406p (best)

it looks as though the highest quality offered in this stream is 406p (this is resolution, not bitrate like in the NRJ12 case). My proxy is too weak to allow for stream downloading, however I managed to get the playlist itself via browser; its contents read:

EXTM3U

EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=233376,RESOLUTION=720x406,CODECS="mp4a.40.5,avc1.42801e"

cherie25low.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=491632,RESOLUTION=640x360,CODECS="mp4a.40.5,avc1.42801e"

cherie25med.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=812144,RESOLUTION=352x198,CODECS="mp4a.40.5,avc1.42801e"

cherie25hi.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=64000,RESOLUTION=352x198,CODECS="mp4a.40.5,avc1.42801e"

cherie25lowaudio.m3u8

As you can see for yourself, the highest resolution stream (720x406=406p) does not correspond to the highest bitrate (BANDWIDTH); that one (812144) corresponds to the stream with only 198p resolution; probably the Cherie25 people have screwed things up... If you are after the stream with best bitrate rather than best resolution, then perhaps use the relative playlist of that stream and issue something like:

livestreamer "hls://nrj-apple-live.adaptive.level3.net/apple/nrj/nrjcheriehd/cherie25hi.m3u8" best

EDIT: I just found a better French proxy and actually downloaded 15MB worth of that quality variant; excellent news! It isn't 352x198 as suggested by the playlist, but actually:

Video: H.264/AVC 720x406 25fps [V: h264 baseline L3.0, yuv420p, 720x406] Audio: AAC 44100Hz stereo 59kbps [A: English [eng](aac he-aacv2, 44100 Hz, stereo, 59 kb/s)]

Have fun!

You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/chrippa/livestreamer/issues/1542#issuecomment-260523392, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AESJ1liwBqg32MnH__T1JvrYd123tHfhks5q-RBGgaJpZM4Kx2xy.

Vangelis66 commented 7 years ago

@scottbernstein

Hi Scott Soon after I submitted my post (actually mere minutes after it went live...), I edited it to include the EDIT2 section: https://github.com/chrippa/livestreamer/issues/1542#issuecomment-260523392 giving you credit! (you can check this by hovering over the edited word in the header of my comment).

However, the Github notifications-by-email system does not alert someone when an original comment has been edited by its author, hence the e-mail you replied to does not include my EDIT2 addendum...

Regards

baptx commented 7 years ago

Hi all,

Thanks for your help, so using name_key=bitrate solves the problem.

I still have some questions:

Why is name_key=bitrate not the default like youtube-dl or mpv where I get best quality directly for all livestreams? What is the difference between HLS and HLS variant? Is there any advantage to use the URLs ending with hi.m3u8? Why does livestreamer selects resolutions instead of bitrates on some livestreams?

scottbernstein-zz commented 7 years ago

@baptx: It can really go either way -- SOMETIMES the best quality video will be selected by the resolution and not bandwidth -- and in most cases the default setting of selecting on resolution produces the best quality option. Even then you might get the best quality based upon random chance. But I think the reason it defaults to resolution is that is more understandable to most people than "bandwidth".

But these are only guesses. The original author of this project has abandoned it, so we will never know.


From: baptx notifications@github.com Sent: Tuesday, November 15, 2016 4:38:25 PM To: chrippa/livestreamer Cc: scottbernstein; Mention Subject: Re: [chrippa/livestreamer] Livestreamer can't find the best resolution of this livestream (#1542)

Hi all,

Thanks for your help, so using name_key=bitrate solves the problem.

I still have some questions:

Why is name_key=bitrate not the default like youtube-dl or mpv where I get best quality directly? What is the difference between HLS and HLS variant? Is there any advantage to use the URLs ending with hi.m3u8? Why does livestreamer selects bitrates instead of resolutions on some livestreams?

You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/chrippa/livestreamer/issues/1542#issuecomment-260777221, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AESJ1op-mttwwDzAZ1EVr9tdjnEQ2xyNks5q-iZRgaJpZM4Kx2xy.

baptx commented 7 years ago

Ok, so it could be considered as a bug since the "best" option does not get the best quality for some livestream. I think I can leave this issue open if someone wants to hack the code and make the best quality available automatically.

Vangelis66 commented 7 years ago

@baptx asked:

I still have some questions (snip) What is the difference between HLS and HLS variant

Hello again; I am not as proficient with livestreamer as possibly @scottbernstein is, but the way I use them is:

"hlsvariant:" to be used with "master" AppleHLS playlists (.m3u8), the ones that contain sub-playlists (i.e. sub-streams) with varying qualities. LS parses the master playlist and then chooses the one accordingly...

"hls:" to be used with an AppleHLS playlist (.m3u8) that corresponds to one only AppleHLS stream; in this case, worst=best. If you try to stream/record such a playlist, you may find that hlsvariant: doesn't work, while hls: does...

Is there any advantage to using the URLs ending with hi.m3u8?

Not that I can see; using the switch suggested by Scott parses the master playlist, while using the "child" playlist I suggested directly omits that; so perhaps a bit quicker, but we are talking microseconds here...

Regards

scottbernstein-zz commented 7 years ago

I actually had started coding up a change to deal with this sort of interesting case when there are multiple qualities for the same resolution when someone pointed out the name_key=bitrate option to me. And that does take care of the issue in most cases. Frankly, @baptx there is no reason NOT to have this be your default setting for hlsvariant streams.


From: baptx notifications@github.com Sent: Tuesday, November 15, 2016 5:12:51 PM To: chrippa/livestreamer Cc: scottbernstein; Mention Subject: Re: [chrippa/livestreamer] Livestreamer can't find the best resolution of this livestream (#1542)

Ok, so it could be considered as a bug since the "best" option does not get the best quality for some livestream. I think I can leave this issue open if someone wants to hack the code and make the best quality available automatically.

You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/chrippa/livestreamer/issues/1542#issuecomment-260786811, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AESJ1h-Ht-NZaGDzeC4NKfqeznnyA0NCks5q-i5jgaJpZM4Kx2xy.

baptx commented 7 years ago

@scottbernstein the advantage of having name_key=bitrate by default is to prevent people being fooled when they ask for the best quality. If I would not have tried another download tool or player, I would have think that the livestream is a very poor quality. Is there any reason not to make it default?

scottbernstein-zz commented 7 years ago

I don't know what the thinking is here. The thing is that this project is dead, so any requests for changes won't happen. On the other hand you can make a request into the fork called Streamlink

On Nov 16, 2016, at 2:10 PM, baptx notifications@github.com<mailto:notifications@github.com> wrote:

@scottbernsteinhttps://github.com/scottbernstein the advantage of having name_key=bitrate by default is to prevent people being fooled when they ask for the best quality. If I would not have tried another download tool or player, I would have think that the livestream is a very poor quality. Is there any reason not to make it default?

You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/chrippa/livestreamer/issues/1542#issuecomment-261040662, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AESJ1mvZXgdnQI3EJ7GffBPZwtdLI3b5ks5q-1RmgaJpZM4Kx2xy.

baptx commented 7 years ago

Since when is the project dead? It is very useful to play HDS (only HLS is supported via JavaScript MSE or ffmpeg / avconv) and YouTube / Dailymotion video URLs. Is there an alternative? What is the difference with youtube-dl?

scottbernstein-zz commented 7 years ago

by "dead" -- the project's owner is no longer maintaining it in any way so it will not get any updates and will eventually become somewhat useless as different streaming sites get updates and the tool doesn't get updated to match. For example there are currently many many code updates checked in but not merged. The maintainer is no longer making updates, so some of the plugins for different sites (Twitch, UStream, others) are breaking as the sites' code has been updated.

There is a fork to the project, as I mentioned, called Streamlink which took this project's code as its starting point and has been incorporating fixes/updates to the plugins, and is also considering new feature requests -- it is being maintained by a team of people so that the current situation with chirppa (who is the sole maintainer of livestreamer) loses interest, we are not out of luck. Like I said -- you can open a feature request in the Streamlink Github and see if anyone shows any interest it taking up your request.


From: baptx notifications@github.com Sent: Wednesday, November 16, 2016 2:22:32 PM To: chrippa/livestreamer Cc: scottbernstein; Mention Subject: Re: [chrippa/livestreamer] Livestreamer can't find the best resolution of this livestream (#1542)

Since when is the project dead? It is very useful to play HDS (only HLS is supported via JavaScript MSE or ffmpeg / avconv) and YouTube / Dailymotion video URLs. Is there an alternative? What is the difference with youtube-dl?

You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/chrippa/livestreamer/issues/1542#issuecomment-261044712, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AESJ1rT8PTwIwEdgrCHfy_M5eUK1iRTvks5q-1f4gaJpZM4Kx2xy.