Page 1 of 2

USB backup camera

Posted: Sat Aug 09, 2025 6:13 pm
by gwynethh
Will a USB based backup camera work with Hudiy? (Yes I saw "Reverse camera
Use prebuilt controls to integrate any camera device for reverse camera functionality." on the front page.

Re: USB backup camera

Posted: Sat Aug 09, 2025 6:49 pm
by hudiy
The prebuilt control for the Reverse Camera in Hudiy uses GStreamer to grab, decode, and render the feed from the camera device.
By default, GStreamer uses v4l2 to communicate with the camera device, but Hudiy provides configuration options to adjust the pipeline to your needs:
https://github.com/wiboma/hudiy/blob/ma ... ersecamera

https://github.com/wiboma/hudiy/blob/ma ... rse-camera

Another way to display video from the camera is to use HTML/JavaScript.
On our GitHub, you can find an example showing how to display the camera feed using the MediaDevices API.

https://github.com/wiboma/hudiy/blob/ma ... amera.html

https://github.com/wiboma/hudiy/blob/ma ... d#web-view
https://github.com/wiboma/hudiy?tab=rea ... plications
https://github.com/wiboma/hudiy/blob/ma ... d#overlays

Re: USB backup camera

Posted: Sat Aug 09, 2025 7:53 pm
by alex124.rh
does the camera screen have a message about safety or any
distance lines on it?

Re: USB backup camera

Posted: Sat Aug 09, 2025 7:58 pm
by hudiy
No, it only displays video from the camera.

Since the built-in control for displaying the camera feed appears above overlays, the only option is to use HTML/JavaScript to display the camera feed and then overlay safety warnings and distance lines there.

Also, as far as we know, some aftermarket cameras already include distance lines in the transmitted video.

Re: USB backup camera

Posted: Wed Sep 24, 2025 2:37 pm
by wkl3968
i get to use this "gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! autovideosink" to display the video live stream. however I get nothing from hudiy triggered reverse. I get this error:

gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! video/x-raw,format=RGBA,width=640,height=480 ! glupload ! qml6glsink name=video-sink
Setting pipeline to PAUSED ...
ERROR: from element /GstPipeline:pipeline0/GstQml6GLSink:video-sink: Failed to connect to Qt
Additional debug info:
../ext/qt6/gstqml6glsink.cc(350): gst_qml6_gl_sink_change_state (): /GstPipeline:pipeline0/GstQml6GLSink:video-sink:
Could not retrieve QGuiApplication instance
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...

I tried without the gst-launch-1.0 also not working.

Re: USB backup camera

Posted: Wed Sep 24, 2025 2:56 pm
by hudiy
wkl3968 wrote: Wed Sep 24, 2025 2:37 pm i get to use this "gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! autovideosink" to display the video live stream. however I get nothing from hudiy triggered reverse. I get this error:

gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! video/x-raw,format=RGBA,width=640,height=480 ! glupload ! qml6glsink name=video-sink
Setting pipeline to PAUSED ...
ERROR: from element /GstPipeline:pipeline0/GstQml6GLSink:video-sink: Failed to connect to Qt
Additional debug info:
../ext/qt6/gstqml6glsink.cc(350): gst_qml6_gl_sink_change_state (): /GstPipeline:pipeline0/GstQml6GLSink:video-sink:
Could not retrieve QGuiApplication instance
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...

I tried without the gst-launch-1.0 also not working.
qml6glsink will not work from gst-launch (command line) as it requires proper OpenGL context which gst-launch does not provide.

Does the default pipeline (https://github.com/wiboma/hudiy/blob/ma ... .json#L275) work for you when it is launched from Hudiy?

If you want to modify the pipeline, you need to make sure the output is qml6glsink, as explained in the documentation: https://github.com/wiboma/hudiy/blob/ma ... ersecamera

Re: USB backup camera

Posted: Wed Sep 24, 2025 3:25 pm
by Campos
How can I make it run by GPIO? If I run the ReverseCamera.py script, it shows the image, but I only want it to show when GPIO state is changed, something similar to OpenAutoPro?

Re: USB backup camera

Posted: Wed Sep 24, 2025 3:52 pm
by hudiy
Hudiy does not use GPIO directly. The simplest approach would be to use Python to read the state of the selected GPIO pin and then send the corresponding SetReverseCameraStatus. To read the GPIO state, you could use, for example, gpiod https://pypi.org/project/gpiod/.

Another idea is to split the ReverseCamera.py example into, for instance, ShowCamera.py and HideCamera.py, read the GPIO state in bash using the pinctrl command, and then run the appropriate script.

We also have in our backlog the creation of examples for handling GPIO and various devices, which we will begin working on soon.

Re: USB backup camera

Posted: Wed Sep 24, 2025 11:31 pm
by wkl3968
The default pipeline, as suggested in the main config file, doesn't work and I'm getting a black screen. That is why I wanted to test in terminal first. I also tried the ReverseCamera.py in the example and no video capture. the video can be streamed using "gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! autovideosink" as shown in the picture. any idea?

Re: USB backup camera

Posted: Thu Sep 25, 2025 9:38 pm
by hudiy
Does it work with:

Code: Select all

v4l2src device=/dev/video0 ! videoconvert ! glupload ! qml6glsink name=video-sink
?