如何在RTSP上发送MJPEG帧

2024-09-28 17:20:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试修改当前的GStreamer管道

appsrc name=source caps=video/x-raw, format=BGR,width=640,height=480,framerate=30/1 ! videoconvert ! x264enc speed-preset=ultrafast tune=zerolatency ! rtph264pay config-interval=1 name=pay0 pt=96

我在PythonRTSP服务器中使用的,使用MJPEG而不是x264

特别是,因为我读到hereavenc_mjpeg是性能更好的编码器,所以我决定使用它。 我尝试的第一件事是用avenc_mjpeg替换x264enc及其参数

另一方面,在我用来读取流的命令中(现在是从终端)

gst-launch-1.0 rtsprc location=127.0.0.1:8554/test is-live=true ! rtph264depay ! h264parse ! avdec_264 ! videoconvert ! videoscale ! autovideosink

我试图删除h264parse并用avdec_mjpeg替换avdec_264

但这行不通

Here我用代码作为开发RTSP服务器的灵感

我不是GStreamer管道的专家

谢谢你的帮助


Tags: name服务器formatsourceraw管道videocaps
1条回答
网友
1楼 · 发布于 2024-09-28 17:20:01

MJPEG基本上是一系列JPEG图像。因此,您可以将帧转换为JPEG格式并进行传输

就你而言:

appsrc name=source caps=video/x-raw, format=BGR,width=640,height=480,framerate=30/1 ! videoconvert ! jpegenc ! rtpjpegpay name=pay0 pt=96

对于接收方:

gst-launch-1.0 rtsprc location=127.0.0.1:8554/test is-live=true ! rtpjpegdepay ! jpegdec ! videoconvert ! videoscale ! autovideosink

相关问题 更多 >