开源库地址
基于go的开源流媒体库:
https://gitee.com/kingecg/gortsplib
概述
这个库里面有好多demo代码,根据demo代码可以很容易实现想要的功能,非常简单易用,如果你不熟悉go语言,可以把demo代码丢给AI,告诉它你的需求,它可以帮你修改,你只需要验证测试……
demo预览
client-query
client-play
client-play-timestamp
client-play-options
client-play-pause
client-play-to-record
client-play-backchannel
client-play-format-av1
client-play-format-g711
client-play-format-g722
client-play-format-h264
client-play-format-h264-convert-to-jpeg
client-play-format-h264-save-to-disk
client-play-format-h264-mpeg4audio-save-to-disk
client-play-format-h265
client-play-format-h265-convert-to-jpeg
client-play-format-h265-save-to-disk
client-play-format-lpcm
client-play-format-mjpeg
client-play-format-mpeg4audio
client-play-format-mpeg4audio-save-to-disk
client-play-format-opus
client-play-format-opus-save-to-disk
client-play-format-vp8
client-play-format-vp9
client-record-options
client-record-pause
client-record-format-g711
client-record-format-g722
client-record-format-h264
client-record-format-h264-from-disk
client-record-format-h265
client-record-format-lpcm
client-record-format-mjpeg
client-record-format-mjpeg-from-image
client-record-format-mpeg4audio
client-record-format-opus
client-record-format-vp8
client-record-format-vp9
server
server-tls
server-h264-save-to-disk
proxy
视频格式支持
codec | documentation | encoder and decoder available |
---|---|---|
AV1 | link | ✔️ |
VP9 | link | ✔️ |
VP8 | link | ✔️ |
H265 | link | ✔️ |
H264 | link | ✔️ |
MPEG-4 Video (H263, Xvid) | link | ✔️ |
MPEG-1/2 Video | link | ✔️ |
M-JPEG | link | ✔️ |
问题处理
针对不同的摄像机进行测试,有一个海康、大华都没问题,有个不知名的小摄像机会报如下错误:
2024/11/22 09:07:52 RTP packet is too big to be read with UDP
2024/11/22 09:07:52 RTP packet is too big to be read with UDP
2024/11/22 09:07:52 RTP packet is too big to be read with UDP
2024/11/22 09:07:52 RTP packet is too big to be read with UDP
2024/11/22 09:07:52 RTP packet is too big to be read with UDP
这个通过修改constants.go文件,将udp的MTU(udpMaxPayloadSize)增大一些:
修改后测试正常没有报错了。