QtQuick VideoItem qtgstreamer preview color problem



  • I am using Qt 5.2.1 on nVidia jetson TX1 embedded board.
    I want to use qtgstreamer pipeline in qt.

    For testing i want to preview videotestsrc on surface of VideoItem defined in qtquick 2.0

    VideoItem {
    id: video
    width: 1920
    height: 1080
    surface: videoSurface1
    }
    
    // Create gstreamer elements
    m_pipeline      = QGst::Pipeline::create();
    QGst::ElementPtr m_source        = QGst::ElementFactory::make("videotestsrc", "videotestsrc");
    
    m_pipeline->setProperty("video-sink", m_videoSink);
    
    // Add elements to pipeline
    m_pipeline->add(m_source);
    m_pipeline->add(m_videoSink);
    
    // Link elements
    m_source->link(m_videoSink);
    

    This work great. and preview appear with proper color.
    But if i add caps to pipeline for 1920x1080 resolution

    // Create gstreamer elements
    m_pipeline      = QGst::Pipeline::create("Video Player + Snapshots pipelin");
    QGst::ElementPtr m_source        = QGst::ElementFactory::make("videotestsrc", "videotestsrc");
    QGst::ElementPtr m_filter        = QGst::ElementFactory::make("capsfilter",	"capsfilter");
    
    m_filter->setProperty("caps", QGst::Caps::fromString("video/x-raw, width=1920, height=1080, format=I420, framerate=30/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_videoSink);
    
    // Link elements
    m_source->link(m_filter);
    m_filter->link(m_videoSink);
    

    The preview appear but its reddish. I think the problem is with format(I420). if i use RGB format color appears ok. but with RGB its slow.
    But with the same pipeline if i use another gstreamer sink element like "autovideosink" or "filesink" the preview appear with normal color.

    So how to preview in videosurface with proper color?


  • Lifetime Qt Champion

    Hi,

    Looking for the QtLocation module ?

    [edit: wrong window... SGaist]



  • Hello SGaist,

    Thanks for the Reply. But i am confused by your reply. How QtLocation is related to VideoItem gstreamer I420 color preview problem?


  • Lifetime Qt Champion

    Absolutely completely unrelated. Typical two windows wrong answer situation. Sorry for that.

    Can you use the YUV422 format ?



  • When you want me to use YUV422 format?
    In pileline caps?

    m_filter->setProperty("caps", QGst::Caps::fromString("video/x-raw, width=1920, height=1080, format=I420, framerate=30/1"));
    

    Available format in videotestsrc

    Capabilities:
          video/x-raw
                     format: { I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE }
                      width: [ 1, 2147483647 ]
                     height: [ 1, 2147483647 ]
                  framerate: [ 0/1, 2147483647/1 ]
          video/x-bayer
                     format: { bggr, rggb, grbg, gbrg }
                      width: [ 1, 2147483647 ]
                     height: [ 1, 2147483647 ]
                  framerate: [ 0/1, 2147483647/1 ]
    

    I have tried I422_10LE and I422_10BE but result in "Internal data flow error.".


  • Lifetime Qt Champion

    Either UYVY or YUYV is YUV422.

    By the way which version of Qt are you using ?

    Support for YUV422 has been added for QML in 5.8 IIRC.



  • I am using QT 5.2.1.
    I think in QT 5.8, direct YUV422 capture supported by QtMutlimedia package. But qt gstreamer supports YUV422 for previous versions also.

    In this case, i am just using videotestsrc plugin as camera source. And that is not UYVY or YUYV.
    If i add caps to pipeline the color conversion issue occur.

    I think, the problem is that video surface shows a wrong color conversion as it considers video frame in BGR not in RGB.
    Any idea or suggestions about how to fix?



  • http://gstreamer-devel.966125.n4.nabble.com/QGst-Quick-VideoSurface-Green-Hue-td4664931.html
    other person having same problem but his getting green instead of red.
    But i am unable to find any solution.
    Perhaps you can help.


  • Lifetime Qt Champion

    What is your image source ?



  • gstreamer "videotestsrc" is image source


  • Lifetime Qt Champion

    I meant the one that is not working correctly. Also the test source ?



  • Ya videotestsrc is also not working with I420 format. giving Red hue preview on Videosurface.

    m_filter->setProperty("caps", QGst::Caps::fromString("video/x-raw, width=1920, height=1080, format=I420, framerate=30/1"));
    

    But if i changed I420 with RGB its showing proper color.

    But if i use RGB for my camera (UYVY) input with videoconvert. I got proper color but its too slow.
    But with I420 preview renders smoothly but Reddish preview.

    In my AMD64 linux pc i tried same with qt 5.5 the preview is with Green Hue.


  • Lifetime Qt Champion

    Can you create a small sample application that shows that behavior ?



  • Please find sample app in below link
    https://drive.google.com/open?id=0B8d7zQv-G71oM1JONzlpR2t1OWc

    There are 4 different cases for videosourece as videotestsrc. For my camera i just replace videotestsrc by v4l2src. But the behavior are same for both sources.

    I am using QT 5.2.1 with qtgstreamer 1.2.0 and gstreamer 1.2.4.

    Please suggest some solution of videosurface color conversion issue or any other videosink element that i can use in qml.



  • can you get any clue whats wrong in my code?


Log in to reply
 

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