2014-02-25, 01:00
I watch a lot of live internet streams, and mainly they use HLS - HTTP Live Streaming. This seems to work just fine in general with XBMC. However, some particular sources (notably, partnered Twitch channels) offer multiple streams for viewing. This is usually done to allow streaming in low-bandwidth situations.
These alternate streams are listed in an extm3u file, as can be seen below. Currently, these are loaded by essentially running
That is, the XBMC Player loads the whole extm3u file. It then passes this file through to ffmpeg for playback, as evidenced in the log snippet below. The log file also shows that ffmpeg does recognise all 4 distinct streams. I was wondering, is it possible to tell ffmpeg to switch to a different stream somehow? I tried hitting buttons on my remote, and my keyboard, but nothing seemed to work. I couldn't find any documentation on whether this was even possible, so if it's not possible just let me know.
Sample EXTM3U file with multiple sources.
Log snippet
These alternate streams are listed in an extm3u file, as can be seen below. Currently, these are loaded by essentially running
Code:
xbmc.Player().play(url_of_extm3u_file)
That is, the XBMC Player loads the whole extm3u file. It then passes this file through to ffmpeg for playback, as evidenced in the log snippet below. The log file also shows that ffmpeg does recognise all 4 distinct streams. I was wondering, is it possible to tell ffmpeg to switch to a different stream somehow? I tried hitting buttons on my remote, and my keyboard, but nothing seemed to work. I couldn't find any documentation on whether this was even possible, so if it's not possible just let me know.
Sample EXTM3U file with multiple sources.
Code:
#EXTM3U
#EXT-X-TWITCH-INFO:NODE="video30.lax01",MANIFEST-NODE="video30.lax01",SERVER-TIME="1393237933.48",USER-IP="124.148.51.249",CLUSTER="lax01",MANIFEST-CLUSTER="lax01"
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="chunked",NAME="Source",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=4126734,RESOLUTION=1920x1080,VIDEO="chunked"
http://video30.lax01.hls.twitch.tv/hls95/sc2proleague_8655128880_67465345/chunked/index-live.m3u8?token=id=DELETED,bid=8655128880,exp=1393324333,node=video30-1.lax01.hls.justin.tv,nname=video30.lax01,fmt=chunked&sig=330518d2cf27ac6fd7015710136bc724316b67ce
#EXT-X-TWITCH-RESTRICTED:GROUP-ID="high",NAME="High",RESTRICTION="chansub"
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="medium",NAME="Medium",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=928000,VIDEO="medium"
http://video30.lax01.hls.twitch.tv/hls95/sc2proleague_8655128880_67465345/medium/index-live.m3u8?token=id=DELETED,bid=8655128880,exp=1393324333,node=video30-1.lax01.hls.justin.tv,nname=video30.lax01,fmt=medium&sig=fa0b1c9200293ba842115befd2f252247dcf2445
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="low",NAME="Low",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=596000,VIDEO="low"
http://video30.lax01.hls.twitch.tv/hls95/sc2proleague_8655128880_67465345/low/index-live.m3u8?token=id=DELETED,bid=8655128880,exp=1393324333,node=video30-1.lax01.hls.justin.tv,nname=video30.lax01,fmt=low&sig=5e9943abbc0a811ab36d77886d2ca9c7b654b20a
#EXT-X-MEDIA:TYPE=VIDEO,GROUP-ID="mobile",NAME="Mobile",AUTOSELECT=YES,DEFAULT=YES
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=164000,VIDEO="mobile"
http://video30.lax01.hls.twitch.tv/hls95/sc2proleague_8655128880_67465345/mobile/index-live.m3u8?token=id=DELETED,bid=8655128880,exp=1393324333,node=video30-1.lax01.hls.justin.tv,nname=video30.lax01,fmt=mobile&sig=62d3a2c1774f75fac9eb0ec5dfc26d85cd80f1c2
Log snippet
Code:
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Input #0, applehttp, from 'http://usher.twitch.tv/select/sc2proleague.json?nauthsig=975ae3f7d80fa3d4cebfc9725da2dbb762cdd403&player=jtvweb&private_code=null&type=any&nauth=%7B%22user_id%22%3Anull%2C%22channel%22%3A%22sc2proleague%22%2C%22expires%22%3A1393242740%2C%22chansub%22%3A%7B%22view_until%22%3A1924905600%2C%22restricted_bitrates%22%3A%5B%22archives%22%2C%22source%22%2C%22high%22%5D%7D%2C%22private%22%3A%7B%22allowed_to_view%22%3Atrue%7D%2C%22privileged%22%3Afalse%7D&allow_source=true':mpeg[BE4D0700]: Metadata:
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: variant_bitrate : 4271367
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 tbr, 90k tbn, 59.94 tbc9971881928448 INFO: ffmpeg[BE4D0700]: Metadata:
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: variant_bitrate : 4271367
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Stream #0:2: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, s16
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Metadata:
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: variant_bitrate : 928000
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Stream #0:3: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 852x480, 29.97 tbr, 90k tbn, 2k tbc:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Metadata:
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: variant_bitrate : 928000
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Stream #0:4: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, s16
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Metadata:
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: variant_bitrate : 596000
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Stream #0:5: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x360, 29.97 tbr, 90k tbn, 2k tbc:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Metadata:
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: variant_bitrate : 596000
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Stream #0:6: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, s16
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Metadata:
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: variant_bitrate : 164000
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Stream #0:7: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 400x226, 14.99 tbr, 90k tbn, 2k tbc:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: Metadata:
21:32:27 T:139971881928448 INFO: ffmpeg[BE4D0700]: variant_bitrate : 164000
21:32:27 T:139971881928448 NOTICE: Opening video stream: 1 source: 256
21:32:27 T:139971881928448 NOTICE: Creating video codec with codec id: 28