srs/trunk
Haibo Chen(陈海博) cbc98dc0d9
rtc2rtmp: Support RTC-to-RTMP remuxing with HEVC. v7.0.43 (#4349)
**Introduce**

This pull request builds upon the foundation laid in
https://github.com/ossrs/srs/pull/4289 . While the previous work solely
implemented unidirectional HEVC support from RTMP to RTC, this
submission further enhances it by introducing support for the RTC to
RTMP direction.

**Usage**

Launch SRS with `rtc2rtmp.conf`

```bash
./objs/srs -c conf/rtc2rtmp.conf
```

**Push with WebRTC**

Upgrade browser to Chrome(136+) or Safari(18+), then open [WHIP
encoder](http://localhost:8080/players/whip.html?schema=http&&codec=hevc),
push stream with URL that enables HEVC by query string `codec=hevc`:

```bash
http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream&codec=hevc
```

This query string `codec=hevc` is used to select the video codec, and
generate lines in the answer SDP.

```
m=video 9 UDP/TLS/RTP/SAVPF 49 123
a=rtpmap:49 H265/90000
```

The encoder log also show the codec:

```
Audio: opus, 48000HZ, channels: 2, pt: 111
Video: H265, 90000HZ, pt: 49
```

**Play with RTMP**

Play HEVC stream via RTMP.

```bash
ffplay -i rtmp://localhost/live/livestream
```

You will see the codec in logs:

```
  Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp
  Stream #0:1: Video: hevc (Main), yuv420p(tv, bt709), 320x240, 30 fps, 30 tbr, 1k tbn
```

You can also use [WHEP
player](http://localhost:8080/players/whep.html?schema=http&&codec=hevc)
to play the stream.

Important refactor with AI:

* [AI: Refactor packet cache for RTC frame
builder.](b8ffa1630e)
* [AI: Refactor the packet copy and free for
SrsRtcFrameBuilder](f3487b45d7)
* [AI: Refactor the frame detector for
SrsRtcFrameBuilder](4ffc1526b9)
* [AI: Refactor the packet_video_rtmp for
SrsRtcFrameBuilder](81f6aef4ed)
* [AI: Add utests for
SrsCodecPayload.codec](61eb1c0bfc)
* [AI: Add utests for VideoPacketCache in
SrsRtcFrameBuilder.](fd25480dfa)
* [AI: Add utests for VideoFrameDetector in
SrsRtcFrameBuilder.](b4aa977bbd)
* [AI: Add regression test for RTC2RTMP with
HEVC.](5259a2aac3)

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
Co-authored-by: winlin <winlinvip@gmail.com>
2025-07-03 08:24:42 -04:00
..
3rdparty rtc2rtmp: Support RTC-to-RTMP remuxing with HEVC. v7.0.43 (#4349) 2025-07-03 08:24:42 -04:00
auto Debugging: Drop the specified N original SRTP packet for testing NACK. 2025-06-15 10:01:08 -04:00
conf Fix error about TestRtcPublish_HttpFlvPlay. v7.0.36 (#4363) 2025-05-29 14:07:56 -04:00
doc rtc2rtmp: Support RTC-to-RTMP remuxing with HEVC. v7.0.43 (#4349) 2025-07-03 08:24:42 -04:00
etc/init.d Squash: Fix bugs 2022-01-13 18:26:28 +08:00
gdb The identifier "ShowCouroutines" needs to be modified to "ShowCoroutines" in order to rectify the typographical error. v6.0.63 (#3703) 2023-07-27 08:12:39 +08:00
ide/srs_clion Build: update build version to v7. v7.0.29 (#4294) 2025-03-21 19:15:05 +08:00
modules Moduels: Refine the description 2021-04-21 11:18:35 +08:00
packaging Windows: Refine cygwin pipeline (#3260) 2022-11-21 14:32:26 +08:00
research Player: Get codec by webrtc api: pc.getStats. v7.0.42 (#4310) 2025-06-04 10:28:46 -04:00
scripts AI: Add guide for Augment. (#4404) 2025-06-27 07:23:45 -04:00
src rtc2rtmp: Support RTC-to-RTMP remuxing with HEVC. v7.0.43 (#4349) 2025-07-03 08:24:42 -04:00
usr/lib/systemd/system Squash: Support RPM. Fix bugs. 2021-11-04 07:37:17 +08:00
.gitignore rtc2rtmp: Support RTC-to-RTMP remuxing with HEVC. v7.0.43 (#4349) 2025-07-03 08:24:42 -04:00
AUTHORS.md Update CHANGELOG for #4309. v7.0.31 2025-04-26 06:58:00 -04:00
AUTHORS.txt Update AUTHORS 2021-08-25 07:43:35 +08:00
configure rtc2rtmp: Support RTC-to-RTMP remuxing with HEVC. v7.0.43 (#4349) 2025-07-03 08:24:42 -04:00
Dockerfile.builds Use new cache image name. v6.0.86 (#3815) 2023-10-08 07:43:14 -05:00
Dockerfile.cov Asan: Refine asan warning message for macOS. 2022-12-31 21:20:51 +08:00
Dockerfile.pkg Merge branch v5.0.103 into develop 2022-12-03 21:15:22 +08:00
Dockerfile.test Fix opus delay options, use ffmpeg-opus in docker test. v6.0.102 (#3883) 2023-11-22 14:58:30 +08:00