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

Support for Steam Broadcasting #621

Open PolarManne opened 9 years ago

PolarManne commented 9 years ago

It just got introduced this morning, and it's be nice to see it implemented. http://steamcommunity.com/?subsection=broadcasts

TkTech commented 9 years ago

The stream is interesting. For now, it appears to require a logged in user to work. Examples are all for this live stream: http://steamcommunity.com/broadcast/watch/76561198067563695

First, a request is made to get the video stream. Example:

http://steamcommunity.com/broadcast/getbroadcastmpd/?steamid=76561198067563695&broadcastid=0

{
    "success": "ready",
    "retry": 0,
    "broadcastid": "12547374920780913142",
    "url": "http://81.171.106.194:80/broadcast/3118622223253298157/manifest/?viewer=87917971236267582",
    "appid": "570",
    "app_title": "Dota 2",
    "title": "Dota 2",
    "viewer_count": 194
}

Then you take the url value in the JSON returned to find the manifest. Example:

http://81.171.106.194/broadcast/3118622223253298157/manifest/?viewer=user_id

Where user_id is your steam community user id (looks like 76561198067563695). Result is as below:

<MPD xmlns="urn:mpeg:DASH:schema:MPD:2011" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="dynamic" availabilityStartTime="2014-12-02T19:54:15Z" publishTime="2014-12-02T19:54:15Z" minimumUpdatePeriod="PT30S" minBufferTime="PT3S" timeShiftBufferDepth="PT120S">
<Period id="1" start="PT0S">
<AdaptationSet id="1" segmentAlignment="true" startWithSAP="1" maxWidth="1280" maxHeight="720" lang="und">
<ContentComponent id="1" contentType="video"/>
<ContentComponent id="2" contentType="audio"/>
<SegmentTemplate timescale="1000" duration="3000" media="http://broadcast.akamai.steamstatic.com/broadcast/3118622223253298157/segment/$Number$/?broadcast_origin=par_valve129" startNumber="1" initialization="http://broadcast.akamai.steamstatic.com/broadcast/3118622223253298157/segment/init/?broadcast_origin=par_valve129"/>
<Representation id="main" mimeType="video/mp4" codecs="avc1.4d4032,mp4a.40.2" sar="1:1" audioSamplingRate="48000" startWithSAP="1" bandwidth="3500"></Representation>
</AdaptationSet>
</Period>
</MPD>

These videos can be rewound, and appear to be in 3 second chunks (the duration field, divided by the timescale field). So for every 3 seconds, you make a request to

... to get the next/previous chunk of mp4 video.

Notes:

Kein commented 9 years ago

For some weird reason it always 3500000 for bandwidth. Regardless of what bitrate source/streamer chooses.

TkTech commented 9 years ago

@Kein Possibly the maximum streaming bandwith from akamai, not the source? I don't think Valve has any control over the message returned by Akamai.

Kein commented 9 years ago

When the streamer chooses resolution it changes accordingly in the manifest, but not the bitrate. That's weird. Source/streamer can stream even at 480@750Kbit/s and the broadcast still will deliver as 480@3500.

???

Tester798 commented 9 years ago

So, is it working now?

VackerSimon commented 9 years ago

@Tester798 I haven't seen any progress.

Tester798 commented 9 years ago

@VackerSimon that's sad( Then I suppose this issue should be open?

VackerSimon commented 9 years ago

@Tester798 It is open.

Tester798 commented 9 years ago

@VackerSimon yes, it's open now.

Igor-Shmidt commented 8 years ago

guys... ... any success? thx