Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. UYVY camera Preview
QtWS: Super Early Bird Tickets Available!

UYVY camera Preview

Scheduled Pinned Locked Moved Unsolved General and Desktop
cameracameraviewfindeyuvuyvygstreamer
9 Posts 2 Posters 5.0k 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.
  • RiteshPanchalR Offline
    RiteshPanchalR Offline
    RiteshPanchal
    wrote on last edited by
    #1

    I am using nVidia Jetson TX1 kit. I have developed TC358748 camera driver for that which output UYVY camera data in 1080p60 FPS.

    I can Preview Camera using gstreamer-1.0 pipleiine. I use nvvidconv (nvidia video converter plugin) to convert UYVY to I420 and then fives to video sink element. and its working perfectly.

    Now i want to view same camera preview in QT GUI with overlays and control button.

    So whats the best way to do this using Qt camera framework or using QtGstreamer?

    I have tried qt camera example but it is not detecting my video0 device as camera. But if i attach USB camera its detecting and showing the preview. I think its due to i need to first convert UYVY format or configure qt camera for UYVY format. Right? is the any example code for this ?

    I also tried qtgstreamer and able to preview videotestsrc to QT GUI videosurface. But if i use v4l2src with nvvidconv i got "internal data flow error" I dont know why.? I can use whole pipeline but in this case i can't preview in QT gui videosurface. i can open separate windows.

    Suggest some solution.

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

    Hi and welcome to devnet,

    Which version of Qt are you using ? IIRC with 5.8 there should be support for uyvy when using QML

    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
  • RiteshPanchalR Offline
    RiteshPanchalR Offline
    RiteshPanchal
    wrote on last edited by
    #3

    Hello,
    Thanks for the reply.

    I am using Qt 5.2.1. which is installed by using apt-get install ubuntu-sdk.
    In release note of 5.8 it stated that "VideoOutput (QML) now supports rendering YUV 4:2:2 (YUYV, UYVY) video frames." I think that means i can play UYVY video without any conversion.

    As i am new to QT. I don't know much about Qt Multimedia framework. But can this be useful to UYVY v4l2 frame from camera? And if yes can you suggest any code snippet or example for that?

    1 Reply Last reply
    0
  • RiteshPanchalR Offline
    RiteshPanchalR Offline
    RiteshPanchal
    wrote on last edited by
    #4

    And what you recommend for my application? use Qt Multimedia framework or Qt gstreamer?

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

    The first thing I'd try is to test with the QML camera example from Qt 5.8.

    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
  • RiteshPanchalR Offline
    RiteshPanchalR Offline
    RiteshPanchal
    wrote on last edited by
    #6

    First of all how to download qt 5.8?
    I am getting only 5.7 from the website. i have installed on my linux PC.
    But for nvidia TX1 i have to compile the source. right?

    Currently i can able to preview My camera output in qml videosurface via following code.
    But i am getting Reddish preview. But if i use autovideosink instead of qml videosurface preview shows with right color.
    Also if i replaced v4l2src by videotestsrc same reddish preview is coming with videosurface.

    So how to get correct color preview with qml viedosurface.?

    
                VideoItem {
                    id: video
    
                    width: 1920
                    height:1080
                    surface: videoSurface1 //bound on the context from main()
                }
    
        // Create gstreamer elements
        m_pipeline      = QGst::Pipeline::create("Video Player + Snapshots pipelin");
        m_source        = QGst::ElementFactory::make("v4l2src", "videotestsrc");
        m_filter        = QGst::ElementFactory::make("capsfilter",	"capsfilter");
        m_convert       = QGst::ElementFactory::make("videoconvert","videoconvert");
        m_filter1       = QGst::ElementFactory::make("capsfilter",	"capsfilter1");
        //m_videoSink       = QGst::ElementFactory::make("autovideosink",	"sink");
    
        m_filter->setProperty("caps", QGst::Caps::fromString("video/x-raw, width=1920, height=1080, format=UYVY, framerate=60/1"));
        m_filter1->setProperty("caps", QGst::Caps::fromString("video/x-raw, width=1920, height=1080, format=I420, framerate=60/1"));
    
        m_pipeline->setProperty("video-sink", m_videoSink);
    
        if (!m_pipeline || !m_source || !m_videoSink) {
            return;
        }
    
        // Add elements to pipeline
        m_pipeline->add(m_source);
        m_pipeline->add(m_filter);
        m_pipeline->add(m_convert);
        m_pipeline->add(m_filter1);
        m_pipeline->add(m_videoSink);
    
        // Link elements
        m_source->link(m_filter);
        m_filter->link(m_convert);
        m_convert->link(m_filter1);
        m_filter1->link(m_videoSink);
    
    1 Reply Last reply
    0
  • SGaistS Offline
    SGaistS Offline
    SGaist Lifetime Qt Champion
    wrote on last edited by
    #7

    You'll have to build it yourself from git. 5.8 is currently being prepared.

    Are you sure you're having a uyvy input and not a yuyv ?

    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
  • RiteshPanchalR Offline
    RiteshPanchalR Offline
    RiteshPanchal
    wrote on last edited by
    #8

    Ok. I will build 5.8.

    And I am sure its UYVY. Because if i use any other videosink or filesink or udpsink i am getting proper color frames.

    1 Reply Last reply
    0
  • RiteshPanchalR Offline
    RiteshPanchalR Offline
    RiteshPanchal
    wrote on last edited by
    #9

    I have successfully build QT 5.8.0 on nVidia TX1 board.
    But with QML video surface sink element still getting Reddish preview.
    https://drive.google.com/open?id=0B8d7zQv-G71oM1JONzlpR2t1OWc

    I also tried 5.8.0 QT C++ camera example.
    but for this example camera preview seen for 1-2 sec and then ubuntu hangs. And also the preview appear with wrong color conversion format.

    So i tried minimal camera example.
    https://drive.google.com/open?id=0B8d7zQv-G71odXN6ZTkxRTRuOGM
    But when i start camera following error comes
    Unable to open the camera "" for read to query the parameter info: "No such file or directory"

    So how can i preview UYVY camera preview in this example?

    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