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 581 forks source link

NHK World - broken plugin? #981

Open mgk69 opened 9 years ago

mgk69 commented 9 years ago

Hi. My NHK World stopped working yesterday, I suspect NHK have changed how their stream works... if you click on the link to watch live it now goes to http://www3.nhk.or.jp/nhkworld/en/live/

The regex seems to match what is in the plugin but then I get an error as below:

C:\Users\Mark>livestreamer http://www3.nhk.or.jp/nhkworld/en/live/ best [cli][info] Found matching plugin nhkworld - Copy for URL http://www3.nhk.or.jp/ nhkworld/en/live/ error: Unable to parse JSON: No JSON object could be decoded ()

Just hoping you can have a look at it.

Thanks, Mark

ghost commented 9 years ago

Just a few notes...

XML:

http://www3.nhk.or.jp/nhkworld/app/tv/hlslive.xml

M3U8:

http://web-cache.stream.ne.jp/www11/nhkworld-tv/global/222714/live.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=1368400,CODECS="avc1.42c01f,mp4a.40.5",RESOLUTION=640x360
http://nhkwglobal-i.akamaihd.net/hls/live/222714/nhkwglobal/index_1180.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1368400,CODECS="avc1.42c01f,mp4a.40.5",RESOLUTION=640x360
http://b-nhkwglobal-i.akamaihd.net/hls/live/222714-b/nhkwglobal/index_1180.m3u8

#EXT-X-STREAM-INF:BANDWIDTH=990000,CODECS="avc1.66.30,mp4a.40.5",RESOLUTION=640x360
http://nhkwglobal-i.akamaihd.net/hls/live/222714/nhkwglobal/index_900.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=990000,CODECS="avc1.66.30,mp4a.40.5",RESOLUTION=640x360
http://b-nhkwglobal-i.akamaihd.net/hls/live/222714-b/nhkwglobal/index_900.m3u8

#EXT-X-STREAM-INF:BANDWIDTH=660000,CODECS="avc1.66.30,mp4a.40.5",RESOLUTION=640x360
http://nhkwglobal-i.akamaihd.net/hls/live/222714/nhkwglobal/index_600.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=660000,CODECS="avc1.66.30,mp4a.40.5",RESOLUTION=640x360
http://b-nhkwglobal-i.akamaihd.net/hls/live/222714-b/nhkwglobal/index_600.m3u8

#EXT-X-STREAM-INF:BANDWIDTH=440000,CODECS="avc1.66.30,mp4a.40.5",RESOLUTION=416x240
http://nhkwglobal-i.akamaihd.net/hls/live/222714/nhkwglobal/index_400.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=440000,CODECS="avc1.66.30,mp4a.40.5",RESOLUTION=416x240
http://b-nhkwglobal-i.akamaihd.net/hls/live/222714-b/nhkwglobal/index_400.m3u8

#EXT-X-STREAM-INF:BANDWIDTH=70400,CODECS="mp4a.40.5"
http://nhkwglobal-i.akamaihd.net/hls/live/222714/nhkwglobal/index_64.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=70400,CODECS="mp4a.40.5"
http://b-nhkwglobal-i.akamaihd.net/hls/live/222714-b/nhkwglobal/index_64.m3u8

This playlist contains different bitrates for the same resolution. This is not implemented yet by default, so you have to add name_key=bitrate to get all available bitrates / resolutions (#962).

livestreamer "hlsvariant://http://web-cache.stream.ne.jp/www11/nhkworld-tv/global/222714/live.m3u8 name_key=bitrate" best
[cli][info] Found matching plugin stream for URL hlsvariant://http://web-cache.stream.ne.jp/www11/nhkworld-tv/global/222714/live.m3u8 name_key=bitrate
[cli][info] Available streams: 1368k (best), 440k, 660k, 70k (worst), 990k
[cli][info] Opening stream: 1368k (hls)

Additionally, there is a secondary backup server for each bitrate. Some modifications are required to handle such playlists.

mgk69 commented 9 years ago

Thanks so much for the quick response! I don't understand any of that really but I found that using this code _livestreamer "hlsvariant://http://web-cache.stream.ne.jp/www11/nhkworld-tv/global/222714/live.m3u8 namekey=bitrate" best opens up VLC and plays - and actually looks a lot better than it used to (I think I used to only get the 660 bandwidth version).

I still think the NHK plugin might be broken though, but this gets it working again.