OBS Receiving stream from twitch - how does it do it?

Moschops

New Member
I've been experimenting with a few ways of receiving a twitch stream, principally from software I'm writing in C++. Mainly for the fun of it; started by fetching some standard rtmp streams, and ended up branching out.

Twitch, it turns out, is a real pain; twitch (expectedly) does not want people simply reaching in and fetching the stream. I can get something going by running streamlink and ffmpeg in processes I create, and once ffmpeg hands over the frames the data is mine to play with. But some streams Twitch won't hand over without authorisation (e.g. higher resolution streams), which is an extra real pain. Embedding a web browser (or running a headless one) to get tokens from Twitch is an extra layer of pain, and it's all becoming too much to bother with.

But I wondered how OBS does its stream fetching from Twitch. Someone suggested that OBS runs a headless browser, and that browser effectively streams from Twitch like any other browser and OBS has to scrape data from that browser. Which I could imagine being made to work, but is a long way from elegant.

Can anyone tell me how OBS goes about using Twitch as a source?
 
Top