Commit Graph

28 Commits

Author SHA1 Message Date
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
winlin
e9d6601f7d For #2136: API: Cleanup no active streams for statistics. v5.0.42 2022-08-19 19:45:19 +08:00
winlin
3d58e98d1c Squash: Support github actions for CI 2021-08-15 21:51:50 +08:00
winlin
97c627f9d4 Squash: Support CLion 2021-07-17 19:43:22 +08:00
winlin
13d015b8fd Squash: Fix random bug 2021-07-04 16:04:51 +08:00
winlin
e74810230a SquashSRS4: Regine DTLS and add regression tests. 4.0.84 2021-03-10 08:29:40 +08:00
winlin
301904467a Update .gitignore 2021-02-10 15:56:34 +08:00
winlin
365d3b8bda Merge SRS3.0 2020-10-31 21:53:15 +08:00
winlin
9a963c6fd2 Fix #509, Always malloc stack on heap. 3.0.153 2020-10-31 21:27:09 +08:00
winlin
94a4eaffda Ignore any dump files 2020-06-26 15:19:48 +08:00
winlin
31ff84c82d Ignore some files 2020-06-09 17:18:31 +08:00
winlin
0a030a4ade Update 2020-03-28 17:42:26 +08:00
winlin
65e8835fb5 Ignore .vscode in git. 2020-01-23 09:24:41 +08:00
winlin
d28e82962d Ignore .vscode in git. 2020-01-23 09:17:01 +08:00
winlin
52c6c7c45d For #1506, ignore video when codec is unknown. 2019-12-05 19:21:43 +08:00
winlin
74c1944e15 Refine config, allow parse multiple times. 2019-04-08 08:31:58 +08:00
winlin
36c41715e7 CI: Cover kernel ts 2019-02-05 09:57:06 +08:00
winlin
917cb4a299 CI: Cover all kernel aac 2019-02-03 20:58:04 +08:00
winlin
c646e3f287 CI: Research support codecov 2019-02-03 09:27:08 +08:00
winlin
c9bed5a8bf Refine mp4 codec for mdat. 2017-04-16 20:16:11 +08:00
winlin
721a8457c2 For #299, Refine init mp4, use fragment 2017-03-19 12:29:38 +08:00
winlin
26c20db2b3 Fix parse srs version bug 2017-02-28 20:03:46 +08:00
winlin
af73e8ee65 Add log functions for srs-librtmp 2017-02-28 16:19:54 +08:00
winlin
b7dd764920 update gitignore 2017-01-09 15:17:08 +08:00
winlin
d29416a5f0 add conf sample for ingest rtsp 2017-01-06 10:47:05 +08:00
winlin
4709d0214c for #711, support prefile for transcode. 3.0.12 2017-01-06 10:39:37 +08:00
winlin
b231550c32 fix #717, #691, http api/static/stream support cors. 3.0.9 2016-12-15 16:22:04 +08:00
winlin
9a3674c624 refine kafka 2016-12-08 11:44:49 +08:00