It would be great to add H.264 10-bit support for HDR streaming

SwimmingTiger

New Member
OBS Studio 28.0 Beta has added HEVC / 10-bit / HDR / HLG support, so I successfully streamed HDR on Bilibili Live with their SRT server. (Note: Frames per second should not exceed 50, otherwise web playback will experience problems.)

屏幕截图 2022-08-12 034026.jpg
屏幕截图 2022-08-12 034237.jpg


屏幕截图 2022-08-12 034126.jpg
屏幕截图 2022-08-12 034853.jpg


Everything looks fine - HLG has SDR compatibility, so devices that don't support HDR have a reasonable SDR rendering; then on HDR capable devices it will have a great HDR look - except for one problem: PC browsers that don't support HEVC (like chrome) don't play at all.

So 10-bit H.264 may be a better compatible solution. As far as I know Chrome and Firefox support it. Even if they don't support HLG, live streams will have a reasonable SDR look. This is much better than not being able to play at all.

---

Note of the screenshots: I used Google Chrome Canary with the --enable-features=PlatformHEVCDecoderSupport parameter in the screenshots, which enables HEVC, PQ and HLG support on Windows. But not every user can be expected to do so.
 
Last edited:

SwimmingTiger

New Member
About the video encoding compatibility of Bilibili Live server:

I think Bilibili Live transmits the TS stream as-is between the SRT server and the client (web, mobile app). So any TS stream that can be played normally by browsers should be compatible with Bilibili Live, including H.264 10-bit.

Bilibili Live has never officially supported HEVC HLG live streaming, but in my tests it worked fine (except for the framerate limit to 50, which I think is a Javascript bug in its web frontend. Their mobile app has no framerate issues when playing HEVC HLG live streams).
 
Last edited:

SwimmingTiger

New Member
About the video encoding compatibility of Bilibili Live server:

I think Bilibili Live transmits the TS stream as-is between the SRT server and the client (web, mobile app). So any TS stream that can be played normally by browsers should be compatible with Bilibili Live, including H.264 10-bit.

Bilibili Live has never officially supported HEVC HLG live streaming, but in my tests it worked fine (except for the framerate limit to 50, which I think is a Javascript bug in its web frontend. Their mobile app has no framerate issues when playing HEVC HLG live streams).
As a complement, some streams on Bilibili Live do have a resolution selector, where the streaming server transcodes the video. However, this feature is only available for streams with a high number of viewers (and the "Original" option is always available). For most streams, only the "Original" option is available, and the server does not do any conversions on the stream.
 

SwimmingTiger

New Member
I didn't expect it to be so easy to build an OBS with x264 10-bit support:
// Just comment them out to get very correct x264 10-bit streaming support
/*switch (voi->colorspace) {
case VIDEO_CS_2100_PQ:
case VIDEO_CS_2100_HLG:
obs_encoder_set_last_error(encoder,
obs_module_text("HdrUnsupported"));
warn_enc(encoder,
"OBS does not support using x264 with Rec. 2100");
return NULL;
}*/


My build: https://github.com/SwimmingTiger/obs-studio/releases
It works fine in Bilibili Live with x264 10-bit HLG (HDR) streaming. Chrome (stable version) even renders HDR properly!
 

Rodney

Forum Moderator
The OBS x264 build is 8 bit and you cannot have a 8+10 bit build. Unless you are actually compiling your own x264 you are in fact streaming 8-bit video with HDR metadata. Which works, sure, but isn't great.

It's unlikely we'll support 10 bit x264, both because having two separate libraries is kind of a pain in the ass as well as the many problems this may cause for users. Given that consumer hardware doesn't support decoding it either, it's not really good for viewers either.

Edit: Based on the screenshot you posted on GitHub you are indeed streaming 8-bit H.264. The codec string tells us as much:
Code:
avc1.64002a
tells us the profile you're using (High, 0x64) and level (0x2a, or 42 which means level 4.2). If you were actually streaming 10 bit the profile would be 0x6e, or "High 10".
 
Last edited:

Rodney

Forum Moderator
The OBS x264 build is 8 bit and you cannot have a 8+10 bit build. Unless you are actually compiling your own x264 you are in fact streaming 8-bit video with HDR metadata. Which works, sure, but isn't great.

To correct myself here, seems like my knowledge of x264 is a bit outdated, since 2018 you can build support both 8 and 10 bit, and as we are at the bleeding edge, ours should do it. However, you would still need to set the "high10" profile, otherwise you are streaming at 8-bit.
 

SwimmingTiger

New Member
... you are in fact streaming 8-bit video with HDR metadata.

... Given that consumer hardware doesn't support decoding it either, it's not really good for viewers either.
This is a bad news. Hopefully PlatformHEVCDecoderSupport will make it into the stable release of Chrome and Edge soon, so that I can use HEVC safely. Almost all mobile devices can play HEVC streams, and desktop PC browsers are my last hurdle.
 
Top