Qt World Summit: Register Today!

Fro me, QCamera failed to work when start it.

  • https://gist.github.com/jerome-diver/ef131edae3d1385386d558927d6a1663

    I try with QWidget, and on that code with QGraphicsView.
    So, with QWidget, no light goes On on camera... with QGraphicsView, camera goes on (light goes ON), but no images out of the QGraphicsView viewer. If i make code for record, there is a perfect recording from camera, the problem is only for show images from camera to screen directly (and then i think: THE VIEWFINDER member function of Qt-5.6).

    Also, what's strange is that from QCamera example (official code from Qt) same problem, but from QML code, that works (some people try it and have no problem... that is more strange again).
    I don't want to use QML code because i need to do more than just a little game for children. Then i want to use C++ code. But... also why QML code do the job and not QCamera ? I read post about something has been change and broken after qt-5.2.1 (regression ?).
    I not see what's wrong in my code (but i hope the problem is from my code... i follow the API, but i may be wrong), my camera is working with many different soft (i'm under linux), in fact, all of soft who use camera is working (so it is not my camera).

    Now 7 month of research and ask and no one really know.

    I'm searching for someone who know something (and really experimented) about Qt and QCamera use with C++. Maybe related links i failed to find too...
    Maybe Qt is not the good choice or need to use something more (i don't know, a plugin or something who can works)... i pain to find solution on that. I pain to find help too.

    Please, help.

  • Lifetime Qt Champion


    What OS are you running on ? What kind of camera is it ?

  • @SGaist Hi,
    archlinux_x86_64 with gcc-multilib
    usb standard webcam recognized as "USB 2.0 Camera". Works with all other softs and with QML code.
    lsusb show this:
    Bus 003 Device 004: ID 0c45:6340 Microdia Camera

    if you want more detail from camera, tell me wich command line should give you more. But, do you have an idea about what this works with QML code and not with C++ code ?
    Also, remember that i give an important information to consider: "recording is working," so it is only the view from setViewFinder who seems to failed (maybe). When i try setViewfinder on a QWidgetVideo, nothing happens (same error on unvalid arguments), when i use (like in this code) for a QGraphicsView, error happens, but camera goes ON (light ON).
    All of this is strange: works partially with C++ code, but only for QGraphicsView,, work with QML... i can not understand what i do wrong.

  • Lifetime Qt Champion

    Ok, then which version of GStreamer are you currently using ?

  • @SGaist GStreamer-1.0
    and because this happen from long time and i never find a solution, also no one from Qt devs find (i think in the storry, only me and you was searching), i'm trying to use Qt5-gstreamer Qt5-gstreamerUi instead. But... if you have an idea, welcome.

  • This post is deleted!

  • Lifetime Qt Champion

    Can you post the error you are seeing when using the widget view finder ?

  • @SGaist yes. There is no error shown on console or anywhere.

  • Lifetime Qt Champion

    Enable the QtMultimedia logging category to see if there's anything giving you a hint.

  • @SGaist, @pauldd find the solution (in an other post)
    have to remove gstreamer-vaapi plugin and then works fine.

Log in to reply