Access multimedia backend data
-
Since I moved to 6.4.0 due to ffmpeg support I'm wondering if there is a way to access its functionality like adding a filter (e. chromakey) to video frames.
I'm using an external library written in Qt 6.3 that uses ffmpeg to open all supported format (with transparency) but if I can move to 6.4 and using Qt native classes it would be better.
Right now what I'm trying to replicate is opening a .webm video with trasparency on it and correctly show in a QLabel.
QMediaPlayer* player = new QMediaPlayer; QVideoSink* vsink = new QVideoSink; QLabel* videoLabel= new QLabel(baseWidget); player->setVideoOutput(vsink); connect(vsink, &QVideoSink::videoFrameChanged, this, [=](const QVideoFrame& frame) { qDebug() << frame.pixelFormat(); videoLabel->setPixmap(QPixmap::fromImage(image)); }); player->setSource(QUrl(videoSrc)); videoLabel->show(); player->play();
I can see the frames correctly, but instead of transparency i get a dark gray pixel. Seems like QMediaPlayer didn't use libvpx-vp9 to open it. Indeed, that external library shows libvpx-vp9 as used codec.
So, basically, the question are:
- how can I change QVideoFrame format to correctly show transparency?
- after that, how can I inject ffmpeg's filters to a QVideoFrame?
-
It seems like there is a bug with video codec used to open webm files. Since VP9 (libvpx-vp9) can read alpha channel from a video is a bug if QVideoFrame has QColor(16,16,16,255) instead of QColor(0,0,0,0), totally transparent. I thought that 6.4 with ffmpeg could read correctly those videos