PDA

View Full Version : Displaying videos with an alpha channel



Mac91
16th July 2013, 09:54
Hey

Is there an easy way to display a video in RGBA in Qt?

If not, do you have any ideas how to do it efficiently? Would loading every frame and displaying them in RGBA work properly?

I want to achieve transparency to further use alpha-blending to change the background of the video as I see fit.

Mac91
16th July 2013, 12:19
In case anyone is interested in: http://harmattan-dev.nokia.com/docs/library/html/qt4/multimedia-videowidget.html theres a solution exactly in



QList<QVideoFrame::PixelFormat> VideoWidgetSurface::supportedPixelFormats(
QAbstractVideoBuffer::HandleType handleType) const
{
if (handleType == QAbstractVideoBuffer::NoHandle) {
return QList<QVideoFrame::PixelFormat>()
<< QVideoFrame::Format_ARGB32
<< QVideoFrame::Format_ARGB32_Premultiplied;
} else {
return QList<QVideoFrame::PixelFormat>();
}
}

it dispays the alpha channel correctly. Now for alpha-blending with the app background.

Mac91
22nd July 2013, 18:02
Turns out if you do everything correctly the QPainter items are alpha blended by default.