Hello,
i try to stream video.mp4 file from opencv-python by using Gstream pipeline. but when i run the pipeline in terminal it 's work successful. my problem is when i try to read a video file by Opencv + pipeline:
-My configuration is: jetson Xavier, jetpack 4.4, Opencv-python V4.5. gst-launch-1.0.
This pipeline is work :
gst-launch-1.0 filesrc location=video.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! omxh264dec ! nvoverlaysink -e
But when i run this follow program i have in result any stream but just message “empty frame”:
import cv2
def _gst_cap_pipeline():
return “filesrc location=video.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! omxh264dec ! appsink sync=false”
source = cv2.VideoCapture(_gst_cap_pipeline(), cv2.CAP_GSTREAMER)
while True:
ret, frame = source.read()
if not ret:
print(‘empty frame’)
break
cv2.imshow(‘send’, frame)
if cv2.waitKey(1)&0xFF == ord(‘q’):
break
Please, anyone can help me to solve the problem !! .
Hi,
i had try this code in my Jetson AGX but it dos’nt work, may be it is the problem of version OpenCV-Pyhton !!!.
i have this erroor when i use your code:
[ERROR:0] VIDEOIO(cvCreateFileCapture_Images(filename.c_str())): raised OpenCV exception:
OpenCV(3.4.14) /tmp/pip-req-build-n7x7y8an/opencv/modules/videoio/src/cap_images.cpp:246: error: (-5:Bad argument) CAP_IMAGES: can’t find starting number (in the name of file): filesrc location=/opt/nvidia/deepstream/deepstream-5.0/samples/streams/sample_1080p_h264.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, format=BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink in function ‘icvExtractPattern’
Src opened, 0x0 @ 0 fps
Failed to open output
can you tell me if it is the OpenCV(3.4.14) that do not take charge pipeline gst-stream !!!, please
Hi,
The default OpenCV is 4.1.1 and it enables gstreamer by default. Please do re-installation through SDKManager and try again. Probably 3.4.14 is a bit old.
system
Closed
October 27, 2021, 5:57am
8
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.