1. 程式人生 > 其它 >Jetson Xavier AGX open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1,

Jetson Xavier AGX open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1,

技術標籤:Jetson Xavier AGXopencvnvidia

Jetson Xavier AGX [ WARN:0] global /home/lijinzhe/opencv/opencv-4.1.1/modules/videoio/src/cap_gstreamer.cpp (933) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
[ WARN:0] global /home/lijinzhe/opencv/opencv-4.1.1/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.

[ WARN:0] global /home/lijinzhe/opencv/opencv-4.1.1/modules/videoio/src/cap_gstreamer.cpp (515) startPipeline OpenCV | GStreamer warning: unable to start pipeline 問題)

Jetson Xavier,AGX 羅技C930C攝像頭,opencv4.1, tensorflow2.4,JetPack4.5
首先可以檢視一下攝像頭是否在位,命令列輸入

ls /dev/video*

我的雖然是外部的攝像頭,但是顯示的是video1

而其實問題並沒有那麼複雜,只是因為你的幀率設定的太高了

而已,把它改為

capture = cv.VideoCapture(0)  # 呼叫攝像頭‘0'一般是開啟電腦自帶攝像頭,‘1'是開啟外部攝像頭(只有一個攝像頭的情況)
capture.set(cv.CAP_PROP_FRAME_WIDTH, 640)
capture.set(cv.CAP_PROP_FRAME_HEIGHT, 480)
capture.set(cv.CAP_PROP_FOURCC, cv.VideoWriter_fourcc('M', 'J', 'P', 'G'))  # 在AGX上不要去直接設定幀率,不好用,主要是opencv預設為YUY2格式的視訊流,最高幀率只有40,而這個MJPG格式可以很高

在這裡插入圖片描述