3
我使用OpenCV VideoCapture捕获视频帧。捕捉工作正常,因为我能够使用这样的帧:如何使用VideoWriter从OpenCV打开GStreamer管道
cv::VideoCapture cap("v4l2src device=/dev/video1 ! videoscale ! videorate ! video/x-raw, width=640, height=360, framerate=30/1 ! videoconvert ! appsink");
cv::imshow("feed", frame);
我也想通过网络发送流,这里是我卡住的地方。不知何故,我在appsrc管道部分失败。我想将流编码为jpeg并通过udp发送。这就是我得到的:
cv::VideoWriter writer
writer.open("appsrc ! videoconvert ! jpegenc ! jpegparse ! rtpjpegpay pt=96 ! udpsink host=192.168.1.25 port=5000", 0, (double)30, cv::Size(640, 360), true);
看起来上面的线没有做任何事。 没有做任何事情。另外这款GStreamer的命令不显示任何内容:
gst-launch-1.0 udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, payload=(int)96" ! rtpjpegdepay ! jpegdec ! decodebin ! videoconvert ! autovideosink
我不知道我在哪里在writer.open
部分失败。如果我像这样运行波纹管GStreamer的命令,他们的工作:
gst-launch-1.0 v4l2src device=/dev/video1 ! videoscale ! videorate ! video/x-raw, width=640, height=360, framerate=30/1 ! jpegenc ! jpegparse ! rtpjpegpay pt=96 ! udpsink host=192.168.1.25 port=5000
gst-launch-1.0 udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, payload=(int)96" ! rtpjpegdepay ! jpegdec ! decodebin ! videoconvert ! autovideosink
嗨,先生!我已经尝试了上面的代码,但是它没有工作,打开VideoWriter时出了什么问题,我在Windows中,并且已经安装了GStreamer并添加到环境路径中。 –
@BahramdunAdil'cout << cv :: getBuildInformation()<< endl;'?的输出是什么? – zindarod
@BahramdunAdil删除您的评论。将输出复制到文本文件,将文件上传到某处并在此处发布链接。这是2K点的用户无法接受的! – zindarod