-
Notifications
You must be signed in to change notification settings - Fork 3
Description
go2rtc is one of the first projects in the World, that support HEVC/H.265
for WebRTC in web browser.
Maybe you can see articles about WebRTC H265 earlier. But I haven't seen any examples where the video was displayed in a popular browser. Some projects can support WebRTC H265 if they are used on the receiving and transmitting sides. But what if there is a real browser on one side?
I tried streaming the RTSP from the Dahua camera to Safari with Janus without success. This works for some H264 cameras, but not all of them. This can work for streaming H265 between two Apple devices. But this does not work for H265 cameras.
All because Apple doesn't respect world standards. You can forgot RTP Payload Format for High Efficiency Video Coding (HEVC) (RFC 7798) then work with Apple devices. They invented their own payload:
- You need a correct H265 stream: VPS, SPS, PPS, I-frame, P-frame(s).
- You need it with Annex-B headers
00 00 00 01
before each NAL unit. - You need split your stream on RTP payloads with one byte header:
03
for payload with VPS, SPS, PPS, I-frame start01
for all next packets from this I-frame02
for payload with P-frame00
for all next packets from this P-frame
- Don't forget set marker flag only for last packet of each Access Units
That's all. Now anyone can try to watch WebRTC H265 in Safari even if don't have H265 cameras. This is because go2rtc has optional transcode feature for almost any stream source:
streams:
sonoff_camera: ffmpeg:rtsp://rtsp:12345678@192.168.1.123:554/av_stream/ch0#video=h265#audio=copy
If you have H265 camera, you can stream it without transcoding, even from Xiaomi Gateway 3. Because go2rtc is a small application that you can install almost anywhere.
Unfortunately Safari is the only browser at the moment that supports H265 for WebRTC.
Device | WebRTC | MSE | MP4 |
---|---|---|---|
latency | best | medium | bad |
Desktop Chrome | H264 | H264, H265* | H264, H265* |
Desktop Safari | H264, H265* | H264 | no |
Desktop Edge | H264 | H264, H265* | H264, H265* |
Desktop Firefox | H264 | H264 | H264 |
Desktop Opera | no | H264 | H264 |
iPhone Safari | H264, H265* | no | no |
iPad Safari | H264, H265* | H264 | no |
Android Chrome | H264 | H264 | H264 |
masOS Hass App | no | no | no |