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