How the Playstation 4 dynamically regulates its streaming bitrate

I’ve been having some trouble with my internet connection lately. Up until two weeks ago I had an upload speed of about 20-25 Mbps, but since then it tanked down to an unstable and unpredictable 1-4 Mbps. I have my best technicians working on it (i.e. my internet provider). Needless to say, this put a damper on streaming at a constant bitrate of 5 Mbps like I usually do. I couldn’t even get OBS to deliver a stable 1Mbps connection.

My wife however was quite happily streaming FORTNITE directly from her PS4, and aside from a bit of blockiness every once in a while, the connection was stable for hours. I on the other hand couldn’t make anything work with OBS, no matter how hard I tried.

So what gives? There has to be some kind of magic in the way the Playstation consoles deal with streaming, on top of everything else. How come it works when OBS does not? I took a look at the data rate while I was test streaming, and found some interesting results.

CBR vs VBR

Video streams can be transcoded either with a constant bitrate (CBR), or with a variable bitrate (VBR). While the latter is better for maximising storage, the former is preferred by streaming providers. Streams don’t like to deal with data rates going up and down, especially not when this happens quickly and dramatically (say from 1Mbps to 20Mbps within a second and back). Hence, Twitch et al tell us to use content bit rates.

My first thought was that perhaps the Playstation 4 would employ VBR instead, but that’s not the case. It uses an intelligent mechanism to test what bandwidth is available, and then adjusts its compression on the fly. It’s fascinating, and I wish we had something like that in OBS.

PS4 Bitrate Guidelines

Sony never made an official statement about what bitrates are used for which streaming setting (currently 360p, 540p and 720p in Standard and High), but an old Eurogamer Article from 2013 and a Stackexchange Post tell us their ball parks from a previous firmware version:

While the descriptions may have changed, the underlying values are probably still correct, Sony have made some improvements under the hood and renamed those presets 360p and 540p, and also added higher presets to the mix (720p for regular PS4 models, and even a 1080p preset for the PS4 Pro). Each is available as a Standard and High version, but I’m not sure what the differences are exactly.

My own tests with a regular PS4 (non-pro) confirm that the “720p High (60fps)” setting can deliver a bitrate of 4Mbps on a healthy connection. That was last year though, when my connection was indeed healthy. But here’s where it gets interesting: On my current intermittent wonky connection, with the same PS4 setting, I’m seeing the following:

The above screenshot is courtesy of of the Twitch Inspector, which gives an insight into the live bitrate of a stream. The red lines indicate a problem like a brief connection loss, or no packets coming in. The purple graph shows the bitrate over time. Notice the little steps we can see after the second red line.

What the Playstation was doing there appears to be regulating the bitrate on the fly, trying to make due with whatever it could send over the connection. It does this without dropping the frame rate or resolution though; that can’t happen once a stream has started. Instead, it compressed the images more, leading to more blockiness. However, there’s still a visible stream available, something that doesn’t happen with OBS.

Each “step” is roughly 3-4 minutes in the above graph. This tells me that once a connection is stable with a bitrate lower than the target (say 4 Mbps in my example), the PS4 streams for 3-4 minuets and then tries an incremental increase. When successful for another 3-4 minutes, it increases the bad with again (seemingly in 500 Kbps steps). It keeps trying until there’s a problem again, at which point it decreases the bandwidth again and increases its compression. How clever is that?

You can watch the original Twitch recording here (it’ll be up for 60 days and will expire after that).

Conclusion

These observations certainly explain why I can’t get a picture out of OBS, while my wife can stream FORTNITE from the PS4. I’d love to see this implemented in OBS.

While streaming directly from games consoles has a certain bad reputation on the street, there’s some clever magic happening behind the scenes, as this example shows. I do appreciate how easy it is to make streaming happen for everybody, without having to pull out your hair and learn more than you ever wanted to know to go online. Less is sometimes more, and this is a great example. I may look into doing streams from the PS4 until my internet connection is fixed.

You can leave a comment on my original post.