Skip to main content

How to Push HEVC via RTMP by OBS

· 2 min read

Written by Winlin, chundonglinlin

OBS 29.1 supports HEVC via RTMP, so you can do HEVC live stream by OBS and SRS now.

There is a new specification for HEVC via RTMP, please see Enhanced RTMP. This specification defines a new codec ID for HEVC, which uses fourCC hvc1, both OBS and SRS support it.

Note: Please see #3495 and #3464 for details.

Please note that SRS 6.0 had already HEVC(H.265) support for SRT, HTTP-TS, HLS, MPEG-DASH and WebRTC(Safari), please refer to H.265 Live Streaming Saving 50% Cost.

Prerequisites

To use HEVC via RTMP, you must:

  • Update SRS to 6.0.42+, or use the latest develop branch.
  • Use OBS 29.1+. You can download the beta version from here.
  • For H5 player, SRS has already upgraded the mpegjs.js to 1.7.3+
  • FFmpeg doesn't support HEVC via RTMP yet, but some of the maintainers are working on it now.

Usage

First, download and build SRS:

git clone http://github.com/ossrs/srs.git
cd srs/trunk
./configure --h265=on
make

Then, start SRS, please make sure the SRS version is 6.0.42+:

./objs/srs -c conf/http.ts.live.conf

Next, start OBS with the following settings in the Settings > Stream tab:

  • Server: rtmp://localhost/live
  • Stream Key: livestream
  • Encoder: Please select the HEVC hardware encoder.

Note: Please note that the HEVC software encoder is too slow to encode the video, so it causes the video laggy.

Now, open the web page to play the HTTP-TS live stream: http://localhost:8080/live/livestream.ts.

You can also play the HLS, DASH or HTTP-FLV live stream, after you enable the HLS or HTTP-FLV in the config file.

What's Next

FFmpeg doesn't support HEVC via RTMP yet, but some of the maintainers are working on it now. However, there is a tutorial to patch FFmpeg, please see here.

Besides, although SRS supports HEVC via WebRTC for Safari, but SRS doesn't support converting the HEVC via RTMP to WebRTC. We're working on it now.

The OBS HEVC software encoder is too slow to encode the video, so it causes the video laggy.

Conclusion

In this article, we introduced how to push HEVC via RTMP by OBS.

Although there are still some works to do, it's already a big step for HEVC live streaming.

We wrote this article with the help of GitHub Copilot.