frosty Wrote:In an earlier post I was asking about the 'high quality' streams offered by the real iPlayer. beebhack suggests it's a higher-res H264 stream still delivered over RTMP (rather than the vp6 or spark encodings). I'd love to see this working on XBMC as they have a noticibly better picture quality compared to the rtmp/vp6 streams. However, I haven't managed to connect successfully to play one of these streams - does anyone know more about how these work?
The rtmp/h264 streams come from Level3 instead of Akamai servers. Packet-sniffing iPlayer connecting to a high-quality stream shows a few differences:- The Akamai server IP is fetched from http://[server]/fcs/ident (returning XML). The Level3 server IP is instead fetched from http://[server]/fcs/ident2 (returning plain text).
- The Akamai servers accept a connection to 'app'='ondemand'. The Level3 servers return 'unknown application' for 'ondemand'. iPlayer is using 'app'='bbciplayertok'. This means the URL for a stream should be something like rtmp://[server]:1935/bbciplayertok/...
- Akamai servers appear to read the auth value from the 'tcUrl' parameter in the RTMP connect packet. This is working as we send the complete URL we're playing as the value of 'tcUrl'
For Level3 servers the real iPlayer doesn't send any URL parameters in the 'tcUrl' param of the RTMP connect packet. There does seem to be a couple of extra (unnamed) parameters at the end of the connect packet however, which look like (bool)<true> and (string)<the-auth-value>. I've tried hacking these in to the connect packet sent by XBMC, but got no joy - the server sends an error reply and closes the connection.
Maybe not quite as simple to get the higher res streams going as I might have hoped. I was looking through the code and wireshark dumps, hacking together all kinds of things to get it going, but the level3 stuff just seems to be so different atm.
I've also used a flash decompiler and got the debugging flash plugin as there is quite a big of debug information coming out of the iplayer flash.
Connecting to an akamai hosted flash you get the following which is well familiar to most:
----->16:14:37 [system_event]
----->#AKAMAI_SERVICE# onConnect() Full media streaming URL is: rtmp://cp41752.edgefcs.net:1935/ondemand/secure/b0008b9k6streaming93605977.flv?auth=daEdJb.dZa3c2aUamdiaibebKb4aeaicIcd-bi6nND-cCp-GonGBnBpJBtEpzK&aifp=v001&slist=secure/b0008b9k6streaming93605977
Connecting to the level3 high quality stream though gives the following:
----->16:16:34 [system_event]
----->The Model is starting Service of type : level3
----->16:16:34 [system_event]
----->connecting to: rtmp://bbciplayertokfs.fplive.net:1935/bbciplayertok with args: true,a3a8801573cc244d6fdd2c54fa7a9918
----->16:16:34 [system_event]
----->connecting to: rtmpt://bbciplayertokfs.fplive.net:80/bbciplayertok with args: true,a3a8801573cc244d6fdd2c54fa7a9918
----->16:16:34 [system_event]
----->connecting to: rtmp://bbciplayertokfs.fplive.net:80/bbciplayertok with args: true,a3a8801573cc244d6fdd2c54fa7a9918
----->16:16:34 [system_event]
----->The Model has sent an event of type : connection_attampt and changed state to : media_queuing
----->16:16:34 [dev_note]
----->FMSConnection.statusHandler( NetConnection.Connect.Success )
----->16:16:34 [dev_note]
----->FMSConnection.statusHandler( NetConnection.Connect.Closed )
----->16:16:34 [dev_note]
----->FMSConnection.statusHandler( NetConnection.Connect.Closed )
----->16:16:34 [system_event]
----->LevelThreeService connected on: rtmp://bbciplayertokfs.fplive.net:80/bbciplayertok
----->16:16:34 [dev_note]
----->LevelThreeService playing file: mp4:b0008b9k6H26493605977
It actually makes 3 different connection attempts, I've not yet seen the rtmpt request connect, but sometimes it answers and connects on 1935, sometimes on 80.
Also you were right about the arguments, the boolean and an anonymous string that is the auth key, although looking at the wireshark logs, perversely they come after the 0x09 end of rtmp packet marker. But from looking at it I'm not sure if there is a single url you can craft that will play the H264 iplayer files, it might need more indepth changes than that, it certainly seems that the bbc iplayer itself has a different codebase for akamai vs level3