0

I have input source as DVD player with video format as UYVY.I want to develop a Qt application which takes UYVY data as input and displays the video frame.I used v4l2 Linux commands in Qt for capture and Qt widget to display video frames. I guess Qt QImage class does not accept UYVY format,it only accepts RGB .So how do i convert my data to RGB? Is there any other method ?? Thanks..

DubSum2
  • 91
  • 1
  • 6

1 Answers1

0

I just found QVideoFrame which supports UYVY http://doc.qt.io/qt-5/qvideoframe.html maybe there is some way to convert to QImage from that with use QVideoFrame::imageFormatFromPixelFormat

QVideoFrame cloneFrame(frame);  
cloneFrame.map(QAbstractVideoBuffer::ReadOnly);   
const QImage img(cloneFrame.bits(),   
                 cloneFrame.width(),   
                 cloneFrame.height(),  
                 QVideoFrame::imageFormatFromPixelFormat(cloneFrame .pixelFormat()));
...
nayana
  • 3,787
  • 3
  • 20
  • 51
  • Actually i implemented the yuv to rgb conversion matrix to my received buffer,but my function is pretty slow,i cant get the desired 25fps throughput. Maybe I should give QVideoFrame a try. – DubSum2 Mar 25 '15 at 05:21
  • In my case I was using gstreamer which was providing GstBuffer with UYVY content. I changed gstreamer caps to format=BGRA and added one videoconvert element and set image format to Format_RGB32 and it just worked. I don't know if you are using gstreamer for v4l2 – nayana Mar 25 '15 at 07:40