Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. 2 usb cameras use in the same page
Forum Updated to NodeBB v4.3 + New Features

2 usb cameras use in the same page

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 116 Views
  • 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.
  • B Offline
    B Offline
    BeyzaK.
    wrote on last edited by
    #1

    I try to use 2 usb cameras in my qml page. One camera opens normally other one stays green screen.

    I am having these errors in Qt Creator.
    Couldn't release V4L2 buffer 22 Invalid argument 0
    error calling VIDIOC_DQBUF 22 Invalid argument

    I though maybe I am trying to start both cameras in the same time so I put timer to start second camera but didn't work.

    MediaDevices {
            id: mediaDevices
    }
    
    CaptureSession {
            id: first_captureSession
            camera: Camera {
                cameraDevice: mediaDevices.videoInputs[0]
                id: camera1
                onErrorOccurred: function(error, errorString) {
                    if (Camera.NoError !== error) {
                        console.log("[qmlvideo] CameraItem.onError error " + error + " errorString " + errorString)
                    }
                }
            }
    }
    
    CaptureSession {
            id: second_captureSession
            camera: Camera {
                cameraDevice:mediaDevices.videoInputs[1]
                id: camera2
                onErrorOccurred: function(error, errorString) {
                    if (Camera.NoError !== error) {
                        console.log("[qmlvideo] CameraItem.onError error " + error + " errorString " + errorString)
                    }
                }
            }
    }
    
    //setVideoSources() is called by a button for now. 
    //Normally cameras has to start when the page created.
    function setVideoSources(){
            camera1.start()
            first_captureSession.videoOutput = main_source
            denemeTimer.start()
    }
    
    Timer {
            id:denemeTimer
            interval: 500; running: false; repeat: false
            onTriggered: {
                camera2.start()
                second_captureSession.videoOutput = minor_source
            }
    }
    
    1 Reply Last reply
    0

    • Login

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