From 51fb1e7bbe34de9e1d2754f0d713af0ec9a935f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Thu, 18 Jul 2024 18:45:08 +0200 Subject: [PATCH] add AV1 codec. --- server/pkg/types/codec/codecs.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/server/pkg/types/codec/codecs.go b/server/pkg/types/codec/codecs.go index 07f51818..372975a2 100644 --- a/server/pkg/types/codec/codecs.go +++ b/server/pkg/types/codec/codecs.go @@ -31,6 +31,8 @@ func ParseStr(codecName string) (codec RTPCodec, ok bool) { codec = VP8() case VP9().Name: codec = VP9() + case AV1().Name: + codec = AV1() case H264().Name: codec = H264() case Opus().Name: @@ -134,6 +136,25 @@ func H264() RTPCodec { } } +// TODO: Profile ID. +func AV1() RTPCodec { + return RTPCodec{ + Name: "av1", + PayloadType: 96, + Type: webrtc.RTPCodecTypeVideo, + Capability: webrtc.RTPCodecCapability{ + MimeType: webrtc.MimeTypeAV1, + ClockRate: 90000, + Channels: 0, + SDPFmtpLine: "", + RTCPFeedback: RTCPFeedback, + }, + // https://gstreamer.freedesktop.org/documentation/av1/av1enc.html + // gstreamer1.0-plugins-bad + Pipeline: "av1enc target-bitrate=4096 cpu-used=4 end-usage=cbr undershoot=95 keyframe-max-dist=15 min-quantizer=4 max-quantizer=20", + } +} + func Opus() RTPCodec { return RTPCodec{ Name: "opus",