I tried to build desktop application with PyQt5+opencv for image recognition system. I’m using GStreamer pipline to get rtsp streaming by rtsp_url = “rtspsrc location=rtsp://192.168.1.50/live1.sdp latency=0 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink”
cap = cv2.VideoCapture(rtsp_url, cv2.CAP_GSTREAMER).
I can run the .py script properly from terminal with python3 ./myapp.py , but after creating myapp.desktop and launching it, i get no image frame from gstreamer.
I’ve already tested with cv2.VideoCapture(0) and cv2.VideoCapture(rtsp_url,cv2.CAP_FFMPEG), it works properly from both terminal and .desktop.
Is there any necessary to adjust gstreamer setting to launch from .desktop?
Thanks in advance.
Hi,
Please try the command and see if video preview is shown:
$ gst-launch-1.0 rtspsrc location=rtsp://192.168.1.50/live1.sdp latency=0 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! xvimagesink sync=0
Hello, DaneLLL! Thanks for your suggestion.
I tried that command the video preview is properly shown.
Also, the following is my app.desktop file.
#!usr/bin/env python3
[Desktop Entry]
Name=MyApp
Version=1.0
Comment=MyApp_version1
Exec=env GST_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/gstreamer-1.0 /usr/bin/python3 /home/waing/Codes/pythonQtTest_GUI/qtpythontest.py
Icon=/home/waing/HumanDetectionSystem/Myapp_Logo.png
Path=/home/waing/Codes/pythonQtTest_GUI/
Terminal=true
Type=Application
Is there any mistakes in that file that I need to change?
Is this still an issue to support? Any result can be shared?
it’s still an issue.
Hi,
Please try with a video file and see if it works:
"filesrc location=test.mp4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! appsink"
Probably it is too early before netowrk is up so the URL cannot be read.
Thanks. I’ve tried your suggestion. But the same condition.It works when open from terminal and can’t get image from .desktop file.
Hi,
It seems like gstreamer is not enabled. Please try
"videotestsrc is-live=1 ! videoconvert ! appsink"
I cannot launch gstreamer with python script.
But after creating executable file with pyinstaller, I finally get the image data from gstreamer while launching with .desktop .
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.