Home        Store        Learn        Blog

4K Camera to Qground

Hello everyone, recently I have bought a 4K camera from ELP, here the link: http://www.webcamerausb.com/elp-new-4k-3840x2160-mjpeg-30fps-camea-module-hdr-mini-usb-20-web-camera-with-no-distortion-lens-p-250.html
I have been trying to conect it to the raspberry for qground control but I can´t. Can someone tell me if this is possible. The picture format is MJPEG/YUY2.

What are you actually struggling with? It specifies that it’s USB2 which should be fine, but since it’s encoded with MJPEG instead of H264 the default gstreamer parameters won’t work.

Are you using this as a replacement for the standard camera, or are you using both? Are you having trouble viewing the video on a monitor attached to the raspberry pi, or are you just trying to get it to stream like the normal bluerobotics camera does?

For streaming to QGC you’ll need to modify ~/companion/scripts/start_video.sh

hi, thanks for the comment, I am trying to use this camera as a replacement for the standard camera, and my problem is mainly with streaming to QGC.
Yes I had seen that the problem was with the output format, so I wanted to see if there was a way that QGC will accept this format.
So is there a possibility to stream to QGC? From what I understood from your final advice I have to modify then code in the raspberry ??

I’ve just thought about it properly and it’s a bit more complicated than I initially implied.

The companion computer (raspberry pi) and QGroundControl are currently hardcoded with gstreamer commands to send and receive H264 encoded video respectively. To stream your 4K video you can either

  • modify just the code on the companion computer to convert your MJPEG stream to a H264 stream (the re-encoding will quite likely be too slow to get your full 30fps framerate, but it might be possible to get it working at a lower framerate)
  • or you can modify the companion computer code to stream MJPEG instead of H264, and rebuild a custom version of QGC that accepts an MJPEG stream instead of the current H264 (rebuilding is a relatively involved process, and still might not run fast enough for the full framerate, but as QGC modifications go it’s likely a change in only one place in the code where gstreamer gets called, so it might not be too bad)

Perfect, thank you very much. I’ll work on it