Gstreamer语言 - 如何从udp源捕获单个帧



当我在客户端流式传输udp和autovideosink时(在本例中发送方和接收方都在同一台主机上),一切工作正常,但是当我尝试文件链接它并捕获单个帧时,所有尝试都失败了。文件已创建,但为空。

来源:

gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw,width=640,height=480,framerate=30/1 ! jpegenc ! rtpjpegpay ! udpsink host=127.0.0.0 port=5000 -e -v

一个不工作的客户端:

$ gst-launch-1.0 udpsrc port=5000 num-buffers=1 ! application/x-rtp,encoding-name=JPEG! rtpjpegdepay ! jpegdec ! jpegenc ! filesink location=test.jpeg -e
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.112594509
Setting pipeline to NULL ...
Freeing pipeline ...

我如何捕获它?

使用jpegenc的快照参数从udpsrc中删除num-buffers=1https://gstreamer.freedesktop.org/documentation/jpeg/jpegenc.html?gi-language=c

这样的东西适合你吗?

gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=JPEG ! rtpjpegdepay ! jpegdec ! jpegenc snapshot=TRUE ! filesink location=test.jpeg

最新更新