UYVY camera Preview



  • 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.


  • Lifetime Qt Champion

    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



  • 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?



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


  • Lifetime Qt Champion

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



  • 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);
    

  • Lifetime Qt Champion

    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 ?



  • 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.



  • 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?



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.