USB backup camera

gwynethh
Posts: 29
Joined: Sat Aug 09, 2025 4:53 pm

USB backup camera

Post 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.
hudiy
Site Admin
Posts: 440
Joined: Mon Jul 14, 2025 7:42 pm

Re: USB backup camera

Post 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
alex124.rh
Posts: 125
Joined: Thu Jul 31, 2025 9:18 am

Re: USB backup camera

Post by alex124.rh »

does the camera screen have a message about safety or any
distance lines on it?
hudiy
Site Admin
Posts: 440
Joined: Mon Jul 14, 2025 7:42 pm

Re: USB backup camera

Post 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.
wkl3968
Posts: 53
Joined: Thu Aug 07, 2025 12:22 pm

Re: USB backup camera

Post 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.
hudiy
Site Admin
Posts: 440
Joined: Mon Jul 14, 2025 7:42 pm

Re: USB backup camera

Post 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
Campos
Posts: 1
Joined: Mon Aug 25, 2025 4:32 pm

Re: USB backup camera

Post 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?
hudiy
Site Admin
Posts: 440
Joined: Mon Jul 14, 2025 7:42 pm

Re: USB backup camera

Post 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.
wkl3968
Posts: 53
Joined: Thu Aug 07, 2025 12:22 pm

Re: USB backup camera

Post 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?
Attachments
Screenshot 2025-09-25 195947.png
Screenshot 2025-09-25 195947.png (586.98 KiB) Viewed 899 times
hudiy
Site Admin
Posts: 440
Joined: Mon Jul 14, 2025 7:42 pm

Re: USB backup camera

Post by hudiy »

Does it work with:

Code: Select all

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