jkjung-avt / tensorrt_demos

TensorRT MODNet, YOLOv4, YOLOv3, SSD, MTCNN, and GoogLeNet
https://jkjung-avt.github.io/
MIT License
1.75k stars 547 forks source link

Can't detect video files on Jetson Xavier #514

Closed tingriley closed 2 years ago

tingriley commented 2 years ago

Hi, Thank you very much for your great work. I am able to run yolov4 detection with a single image or from a USB camera. However, if the input source is a video file, then it raises the following errors.

nvbuf_utils: Could not get EGL display connection Opening in BLOCKING MODE NvMMLiteOpen : Block : BlockType = 261 NVMEDIA: Reading vendor.tegra.display-size : status: 6 NvMMLiteBlockCreate : Block : BlockType = 261 [ WARN:0] global /tmp/pip-install-v8b457ln/opencv-contrib-python_6c4a43c632ab4215b62744e5ad267fcf/opencv/modules/videoio/src/cap_gstreamer.cpp (1761) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module qtdemux0 reported: Internal data stream error. [ WARN:0] global /tmp/pip-install-v8b457ln/opencv-contrib-python_6c4a43c632ab4215b62744e5ad267fcf/opencv/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline [ WARN:0] global /tmp/pip-install-v8b457ln/opencv-contrib-python_6c4a43c632ab4215b62744e5ad267fcf/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created WARNING:root:Camera: starting while cap is not opened! ERROR: failed to open camera!

This issue can be solved by adding the following code to utils/camera.py pipeline = 'filesrc location=%s ! decodebin ! ' % self.video_file

cvt_pipeline = ( 'nvvidconv interpolation-method=5 ! ' 'video/x-raw, format=BGRx !' 'videoconvert ! appsink sync=false' ) stream = pipeline + cvt_pipeline self.cap = cv2.VideoCapture(stream)

Do you have any idea how this is caused? Thank you!

jkjung-avt commented 2 years ago

If your modification works OK, keep it. The problem seems to be that "cv2" does not know how to decode your video file.