webRTC H265/HEVC编程指南

概述

随着高清视频的普及视频编码H264已经落后了,H265/AV1成了高清视频最佳选择,metaRTC是最早实现也是最成熟的H265 webRTC开源SDK,但AV1生态还不成熟国内还是以H265为主。

随着chrome 136版本开始支持H265解码,webRTC开始进入H265/AV1时代,metaRTC7.0最新版修复了和chrome H265对接的bug,新版本已经全面兼容chrome webRTC H265。

metaRTC7.0后续版本将以H265/AV1为应用重心,大力加强webRTC H265/AV1生态建设。

下载

复制代码
git clone https://github.com/metartc/metaRTC
git clone https://gitee.com/metartc/metaRTC

参数设置

复制代码
typedef enum YangVideoCodec{
	Yang_VED_H264,
	Yang_VED_H265,
	Yang_VED_AV1,
	Yang_VED_VP8,
	Yang_VED_VP9,
	Yang_VED_MJPEG
}YangVideoCodec;

YangAVInfo avinfo;
avinfo.video.videoEncoderType=Yang_VED_H265;

或者配置文件yang_config.ini
[video]
videoEncoderType=1

SDP

复制代码
m=video 9 UDP/TLS/RTP/SAVPF 49
c=IN IP4 0.0.0.0
a=ice-ufrag:192252g
a=ice-pwd:8q31k7bexd60295om1120s83976lniiv
a=ice-options:trickle
a=fingerprint:sha-256 C5:7B:2C:5F:91:AF:4A:5D:A4:84:AB:36:37:4F:7C:9A:12:80:BE:73:05:3E:B8:76:4D:A1:5A:41:6C:40:7D:11
a=setup:passive
a=mid:1
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=sendonly
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:49 H265/90000
a=rtcp-fb:49 transport-cc
a=rtcp-fb:49 nack
a=rtcp-fb:49 nack pli
a=fmtp:49 level-id=93;profile-id=1;tier-flag=0;tx-mode=SRST

H265参数:a=fmtp:49 level-id=93;profile-id=1;tier-flag=0;tx-mode=SRST

profile-id

|---|--------------------|---------------------|----------|
| 1 | Main Profile (MP) | 主流应用,8-bit 4:2:0 | 通用视频 |
| 2 | Main 10 Profile | 10-bit 4:2:0,支持HDR | 4K/HDR内容 |
| 3 | Main Still Picture | 静态图片 | 照片 |
| 4 | Range Extensions | 扩展范围,支持4:2:2, 4:4:4 | 专业制作 |

tier-flag

  • 0Main Tier(主流层)
  • 1High Tier(高层)

Level 4.1:

  • Main Tier: 最大码率 20 Mbps

  • High Tier: 最大码率 50 Mbps

Level 5.1:

  • Main Tier: 最大码率 100 Mbps

  • High Tier: 最大码率 250 Mbps

level-id

|-----------|-----|
| Level 1 | 30 |
| Level 2 | 60 |
| Level 2.1 | 63 |
| Level 3 | 90 |
| Level 3.1 | 93 |
| Level 4 | 120 |
| Level 4.1 | 123 |
| Level 5 | 150 |
| Level 5.1 | 153 |
| Level 5.2 | 156 |
| Level 6 | 180 |
| Level 6.1 | 183 |
| Level 6.2 | 186 |

相关推荐
CodeOfCC1 天前
C++ 基于kmp解析nalu
c++·音视频·实时音视频·h.265·h.264
qq_310658511 天前
webrtc源码走读(四)核心引擎层——视频引擎
服务器·c++·音视频·webrtc
qq_310658512 天前
webrtc源码走读(三)核心引擎层——音频引擎
服务器·c++·音视频·webrtc
book_bbyuan2 天前
webrtc AGC的通俗说明
webrtc
qq_310658513 天前
webrtc源码走读(一)WebRTC源码结构拆分
服务器·c++·音视频·webrtc
qq_310658513 天前
webrtc源码走读(二)应用层如何使用WebRTC API实现功能
服务器·c++·音视频·webrtc
kkk_皮蛋3 天前
构建一个完整的 WebRTC 通信系统 (架构篇)
架构·webrtc
foxsen_xia3 天前
WebRTC 连接建立流程
webrtc
kkk_皮蛋4 天前
WebRTC 安全机制 (DTLS、SRTP、ICE、权限管理)
安全·webrtc
kkk_皮蛋5 天前
在移动端使用 WebRTC (Android/iOS)
android·ios·webrtc