Issue with OV5640 on Ixora with Apalis iMX6Q 1GB in QML

Hi

I have a problem with the camera module OV5640 v1.1A connected to an Ixora v1.1A with an Apalis iMX6Q 1GB v1.1B. Additionally a capacitive touchscreen is connected to the Ixora.

The problem arises when I try to use the camera in a Qt Application (QML). I create a Camera via

import QtMultimedia 5.8
Camera {
    id: camera
    deviceId: "video1"
}

And want to show the output on a VideoOutput:

VideoOutput {
        id: video
        source: camera
}

The camera seems to be found by Qt. The following yields the expected results:

print(QtMultimedia.availableCameras.length) // prints 1
print("deviceId: " + QtMultimedia.availableCameras[0].deviceId) // prints deviceId: /dev/video1
print("displayName: " + QtMultimedia.availableCameras[0].displayName) // prints displayName: video1

But I also get the following errors and the image is never displayed in the VideoOutput.

(qt_app:11892): GStreamer-CRITICAL **: gst_value_set_fraction: assertion 'denominator != 0' failed
(qt_app:11892): GStreamer-CRITICAL **: gst_value_set_fraction: assertion 'denominator != 0' failed
Unable to query the parameter info: "Invalid argument"
Unable to query the parameter info: "Invalid argument"
Unable to query the parameter info: "Invalid argument"
Unable to query the parameter info: "Invalid argument"
Unable to query the parameter info: "Invalid argument"
Unable to query the parameter info: "Invalid argument"
CameraBin error: "Failed to allocate required memory."
CameraBin error: "Internal data stream error."

I built the image using BSP 2.8b5 based on the recipe “angstrom-qt5-x11-image” to which I added:

  • In local.conf:

    IMAGE_INSTALL_append = " qtquickcontrols qtquickcontrols2 qtmultimedia qtdeclarative"
    IMAGE_INSTALL_append = " opencv"

  • In qtmultimedia_git.bb: Added “gstreamer” to PACKAGECONFIG (based on info from here)

    PACKAGECONFIG ??= “${@bb.utils.contains(‘DISTRO_FEATURES’, ‘alsa’, ‘alsa’, ‘’, d)}
    ${@bb.utils.contains(‘DISTRO_FEATURES’, ‘pulseaudio’, ‘pulseaudio’, ‘’, d)}
    gstreamer”

  • In angstrom-qt5-x11-image.bb: Added “gstreamer1.0-plugins-bad-meta \” to GSTREAMER

    GSTREAMER = "
    gstreamer1.0
    gstreamer1.0-plugins-bad-meta

    These steps (except the inclusion of opencv) seemed to be necessary to get rid of the following error when running my QML code.

    defaultServiceProvider::requestService(): no service found for - “org.qt-project.qt.camera”
    Additional info:

The example given on here to run the camera with gstreamer does not work for me:

gst-launch-1.0 -v imxv4l2src device=/dev/video1 ! capsfilter caps="video/x-raw, width=1280, height=720, framerate=30/1" ! queue ! imxv4l2sink
WARNING: erroneous pipeline: no element "imxv4l2src"

I did run “setenv fdt_file imx6q-apalis-ixora-v1.1.dtb; saveenv” in U-Boot. The following command however is working and the camera feed is displayed on the connected display:

gst-launch-1.0 imxv4l2videosrc device=/dev/video1 ! autovideosink

So apparently the camera is recognized by the board and working.

v4l2-ctl shows the following information for /dev/video1:

v4l2-ctl -V --device=/dev/video1
[ 7240.458024] ov5640_set_virtual_channel: virtual channel=1
Format Video Capture:
    Width/Height      : 640/480
    Pixel Format      : 'UYVY'
    Field             : None
    Bytes per Line    : 1280
    Size Image        : 614400
    Colorspace        : Default
    Transfer Function : Default
    YCbCr/HSV Encoding: Default
    Quantization      : Default

On the host computer, the application works fine using the internal webcam of my laptop.

What might be the problem here? Is this a Gstreamer issue? Or do I have to do some additional steps to set up the camera module?

Best
Patrik

It is working now. I had to define the following environment variables:

QT_GSTREAMER_CAMERABIN_VIDEOSRC="imxv4l2videosrc"
DISPLAY=":0"
QT_GSTREAMER_CAMERABIN_VIDEOSRC_DEVICE="/dev/video1"

I did this directly in the main.cpp file:

qputenv("QT_GSTREAMER_CAMERABIN_VIDEOSRC", "imxv4l2videosrc");
qputenv("DISPLAY", ":0");
qputenv("QT_GSTREAMER_CAMERABIN_VIDEOSRC_DEVICE", "/dev/video1");

Thanks for letting us know.

As for the video0 vs. video1 issue, you may just only deploy resp. Linux kernel modules as required for your OV5640 which should lead to only this one being probed during boot and assigned video0 instead.