Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QCamera is not working with CMOS-MIPI-OV5640
Forum Updated to NodeBB v4.3 + New Features

QCamera is not working with CMOS-MIPI-OV5640

Scheduled Pinned Locked Moved Solved Mobile and Embedded
16 Posts 2 Posters 3.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    Can you access that camera properly from gstreamer ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • N Offline
      N Offline
      nikita.panchal09
      wrote on last edited by
      #3

      Yes.

      I am able to get live stream with :
      gst-launch-1.0 imxv4l2videosrc device=/dev/video0 ! imxeglvivsink

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Do you have any error printed on the command line when running your Qt application ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • N Offline
          N Offline
          nikita.panchal09
          wrote on last edited by
          #5

          Hi Devent,

          First of thank you for looking into it.
          Qt application itself doesn't print any error on console.

          While analyze the problem I identified two things as below:

          1. Difference between Camera Start method on laptop and IMX6.
            On laptop: pCamera->start() followes status: LoadingStatus -> LoadedStatus -> StartingStatus -> ActiveStatus.
            On IMX6 : pCamera->start() followes status: LoadingStatus
            So, It is stuck to change status from "LoadingStatus" to "LoadedStatus".

          2. I got below error with dmesg command:
            pid: 1170
            uid: [ 1001]
            tgid: 1170
            total_vm:220354
            rss: 150081
            nr_ptes: 405
            nr_pmds: 0
            swapents: 0
            oom_score_adj: 0
            name: CameraStartApp
            Out of memory: Kill process 1170 (CameraStartApp) score 587 or sacrifice child
            Killed process 1170 (CameraStartApp) total-vm:881416kB, anon-rss:599680kB, file-rss:0kB, shmem-rss:644kB

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            Looks like a device specific source

            @nikita.panchal09 said in QCamera is not working with CMOS-MIPI-OV5640:

            imxv4l2videosrc

            You should consider modifying the gstreamer plugin to use that one in place of the camerabin it currently uses.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • N Offline
              N Offline
              nikita.panchal09
              wrote on last edited by
              #7

              Hi,

              Thank you for your answer.
              Actually, I am new to GStreamer and qtmultimedia. I would be grateful, if you can provide steps or related website-link to do these things.

              Meanwhile, I found the hardcoded value of camera source as "v4l2src" in below files from QT source. Do these both files requires to change to "imxv4l2videosrc" from "v4l2src" and build it again?

              1. qtmultimedia-5.12/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.cpp:70: GstElement *camera = gst_element_factory_make("v4l2src", "camera_source");
              2. qtmultimedia-5.12/src/plugins/gstreamer/camerabin/camerabinsession.cpp:542: m_videoSrc = gst_element_factory_make("v4l2src", "camera_source");

              Thanks.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                That's what I would try first yes. No need to rebuild all of Qt. Only the GStreamer plugin.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • N Offline
                  N Offline
                  nikita.panchal09
                  wrote on last edited by
                  #9

                  Hi,

                  I followed below steps:

                  • Downloaded qt-multimedia
                  • Edited mentioned files with "imxv4l2videosrc"
                  • Compiled and Installed.

                  It works...! I am able to start the camera.

                  Thank you

                  1 Reply Last reply
                  3
                  • N Offline
                    N Offline
                    nikita.panchal09
                    wrote on last edited by
                    #10

                    Hi,

                    Currently, I am trying to record video on IMX6(Debian Stretch 9.5). I am using QT multimediawidget "camera" example (Using QCamera and QMediaRecorder).
                    The problem is, On record start (recorder->record) the camera output is slowed down extremely. and after approximate 15 seconds, It gives below error and streaming gets stopped.
                    "CameraBin error: "Internal data stream error."

                    I am able to record video with gstreamer using below command and it works fine.
                    gst-launch-1.0 imxv4l2videosrc device=/dev/video0 imx-capture-mode=5 fps-n=30 ! queue ! imxvpuenc_h264 bitrate=10000 ! avimux ! filesink location=test.avi

                    Looking forward to hearing.

                    Thank You.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      From the looks of it, imxvpuenc_h264 is likely optimised for your device. I would go check the qgstreamercapturesession.cpp content to see how to possibly modify the pipeline to use that encoder.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • N Offline
                        N Offline
                        nikita.panchal09
                        wrote on last edited by
                        #12

                        Hi,

                        Thanks for your answer.

                        While analyzing the problem I found below things as per below:

                        1. In the computer, it saves video file as .mkv and in the board, It saves as .ogg
                        2. After camera record start it gives error as "CameraBin error: "Internal data stream error."
                          simultaneously on the console, I am getting "ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0" error.
                        3. As per your saying I have to write codec "imxvpuenc_h264". But I am confused that where to change it.
                          I have changed "x264enc" to "imxvpuenc_h264" in file qgstreamervideoencode.cpp. But, while recording It is not executing.

                        Thanks,
                        Nikita Panchal

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #13

                          What do you mean by "not executing" ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • N Offline
                            N Offline
                            nikita.panchal09
                            wrote on last edited by
                            #14

                            I have put "qDebug()" on it. It doesn't print on recording start.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #15

                              Maybe a silly question but are you sure you replaced the plugin once you built it ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • N Offline
                                N Offline
                                nikita.panchal09
                                wrote on last edited by
                                #16

                                Hi,

                                I have applied "0001-QCamera-can-t-set-recording-container-format-video-a.patch" patch from below link and it works for me.
                                "https://community.nxp.com/docs/DOC-330047"
                                Thanks for your support.

                                1 Reply Last reply
                                1

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved