<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Blackscreen when using void QMediaPlayer::setVideoOutput(const QVector&lt;QAbstractVideoSurface *&gt; &amp;surfaces)]]></title><description><![CDATA[<p dir="auto">Hi Guys,</p>
<p dir="auto">currently I want to show 4 videos on 4 different Displays. The videos should be synchronized.  Therefore I created a QVideoWidget for every Display stored in</p>
<pre><code>      QList&lt;QVideoWidget*&gt; vws = {}; 
</code></pre>
<p dir="auto">Then  I created the QVector with the QAbstractVideoSurfaces</p>
<pre><code>QVector&lt;QAbstractVideoSurface*&gt; *surfaces = new QVector&lt;QAbstractVideoSurface*&gt;;

        for(int i = 0; i &lt; qApp-&gt;screens().count(); i++){
            if( i != displayToUse_NotBlocking){
                VideoSurface *vs = new VideoSurface(vws.at(i)-&gt;videoSurface());

                QVideoSurfaceFormat format(qApp-&gt;screens().at(i)-&gt;geometry().size(), QVideoFrame::Format_RGB32);

                vws.at(i)-&gt;show();
                vws.at(i)-&gt;showFullScreen();
        
                vs-&gt;start(format);
                surfaces-&gt;append(vs);

                qDebug()&lt;&lt; vs-&gt;surfaceFormat();
            }
        }
</code></pre>
<p dir="auto">Here VideoSurface is the class implementing the QAbstractVideoSurface</p>
<pre><code>#ifndef VIDEOSURFACE_H
#define VIDEOSURFACE_H

#include &lt;QtMultimedia&gt;
#include &lt;QAbstractVideoSurface&gt;
#include &lt;QVideoFrame&gt;
#include &lt;QAbstractVideoBuffer&gt;
#include &lt;QLabel&gt;
#include &lt;QApplication&gt;
class VideoSurface : public QAbstractVideoSurface
{
public:

    VideoSurface(QObject *parent = nullptr): QAbstractVideoSurface(parent) {};

    QList&lt;QVideoFrame::PixelFormat&gt; supportedPixelFormats(
            QAbstractVideoBuffer::HandleType handleType) const
    {
        if (handleType == QAbstractVideoBuffer::NoHandle) {
            QList&lt;QVideoFrame::PixelFormat&gt; *list = new QList&lt;QVideoFrame::PixelFormat&gt;;
            list-&gt;append(QVideoFrame::Format_YUV420P);
            list-&gt;append(QVideoFrame::Format_RGB24);
            list-&gt;append(QVideoFrame::Format_BGR32);
            list-&gt;append(QVideoFrame::Format_BGR24);
            list-&gt;append(QVideoFrame::Format_RGB32);

            return *list;
        } else {
            return QList&lt;QVideoFrame::PixelFormat&gt;();
        }
    }

    // nothing is done with the image in here
    bool present(const QVideoFrame &amp;frame)
    {
        qDebug() &lt;&lt; frame.pixelFormat();



        return true;
        }

};





#endif // VIDEOSURFACE_H
</code></pre>
<p dir="auto">Then I added the output to a previously created QMediaPlayer and started the video.</p>
<pre><code>globalplayer-&gt;setVideoOutput(*surfaces);
        globalplayer-&gt;setMedia(QUrl::fromLocalFile("MyPath"));

        qDebug() &lt;&lt; "isVideoAvailable: " &lt;&lt; globalplayer-&gt;isVideoAvailable();
        qDebug() &lt;&lt; ": " &lt;&lt; globalplayer-&gt;mediaStatus();
        globalplayer-&gt;play();
</code></pre>
<p dir="auto">Now I only see a black screen. But a frame is obviously grabbed in the present() function. (qDebug Output here: Format_RGB32)</p>
<p dir="auto">Has anyone an idea what I#M doing wrong ? Do  i have to process the frame ? If only use globalplayer-&gt;setVideoOutput(QVideoWidget) everything works fine.</p>
<p dir="auto">Kind regards,</p>
<p dir="auto">Kobe</p>
<p dir="auto">PS: If there is a way to show 4 <strong>different</strong> videos in sync, pls let me know</p>
]]></description><link>https://forum.qt.io/topic/127168/blackscreen-when-using-void-qmediaplayer-setvideooutput-const-qvector-qabstractvideosurface-surfaces</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 19:49:10 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/127168.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 31 May 2021 13:41:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Blackscreen when using void QMediaPlayer::setVideoOutput(const QVector&lt;QAbstractVideoSurface *&gt; &amp;surfaces) on Mon, 07 Jun 2021 07:12:00 GMT]]></title><description><![CDATA[<p dir="auto">I already gave up on this approach... Now I'm generating a QVideoWidget which is as wide and high as the full virtual Desktop and I'm just playing one video. Before that I'm generating a video which is exact the width and height of the virtual desktop.</p>
]]></description><link>https://forum.qt.io/post/663782</link><guid isPermaLink="true">https://forum.qt.io/post/663782</guid><dc:creator><![CDATA[kk17baba]]></dc:creator><pubDate>Mon, 07 Jun 2021 07:12:00 GMT</pubDate></item><item><title><![CDATA[Reply to Blackscreen when using void QMediaPlayer::setVideoOutput(const QVector&lt;QAbstractVideoSurface *&gt; &amp;surfaces) on Mon, 07 Jun 2021 07:00:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kk17baba">@<bdi>kk17baba</bdi></a><br />
It works for me though. Can you post your code when trying that?<br />
You shouldn't write your own if you want use <code>QVideoWidget</code>, otherwise you should also write your own widget for displaying the video (which is far more complicated).</p>
]]></description><link>https://forum.qt.io/post/663777</link><guid isPermaLink="true">https://forum.qt.io/post/663777</guid><dc:creator><![CDATA[Bonnie]]></dc:creator><pubDate>Mon, 07 Jun 2021 07:00:54 GMT</pubDate></item><item><title><![CDATA[Reply to Blackscreen when using void QMediaPlayer::setVideoOutput(const QVector&lt;QAbstractVideoSurface *&gt; &amp;surfaces) on Mon, 07 Jun 2021 06:41:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/bonnie">@<bdi>Bonnie</bdi></a> I tried this before and it didn't work. So i thought i might have to implement supportedPixelFormats() and present().</p>
]]></description><link>https://forum.qt.io/post/663773</link><guid isPermaLink="true">https://forum.qt.io/post/663773</guid><dc:creator><![CDATA[kk17baba]]></dc:creator><pubDate>Mon, 07 Jun 2021 06:41:44 GMT</pubDate></item><item><title><![CDATA[Reply to Blackscreen when using void QMediaPlayer::setVideoOutput(const QVector&lt;QAbstractVideoSurface *&gt; &amp;surfaces) on Wed, 02 Jun 2021 05:51:28 GMT]]></title><description><![CDATA[<p dir="auto">Hi, why do you write your own VideoSurface  class instead of just using <code>vws.at(i)-&gt;videoSurface()</code>?</p>
]]></description><link>https://forum.qt.io/post/662964</link><guid isPermaLink="true">https://forum.qt.io/post/662964</guid><dc:creator><![CDATA[Bonnie]]></dc:creator><pubDate>Wed, 02 Jun 2021 05:51:28 GMT</pubDate></item><item><title><![CDATA[Reply to Blackscreen when using void QMediaPlayer::setVideoOutput(const QVector&lt;QAbstractVideoSurface *&gt; &amp;surfaces) on Wed, 02 Jun 2021 05:16:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> No, I'm just converting. Thanks for your help!</p>
]]></description><link>https://forum.qt.io/post/662961</link><guid isPermaLink="true">https://forum.qt.io/post/662961</guid><dc:creator><![CDATA[kk17baba]]></dc:creator><pubDate>Wed, 02 Jun 2021 05:16:59 GMT</pubDate></item><item><title><![CDATA[Reply to Blackscreen when using void QMediaPlayer::setVideoOutput(const QVector&lt;QAbstractVideoSurface *&gt; &amp;surfaces) on Tue, 01 Jun 2021 19:30:57 GMT]]></title><description><![CDATA[<p dir="auto">Neither will help.</p>
<p dir="auto">As written before, beside the platform limitations, to the best of my knowledge, you can only get YUV in QtQuick.</p>
<p dir="auto">Are you doing any pre-processing with ffmpeg beside converting to YUV ?</p>
<p dir="auto">Because depending on your file getting the exact same frame at the same time for different videos will be highly complicated. Video files are not video reels where you always have 24/25 images per second. Depending on the format, compression, video content, etc, you will have a various number of full frames the rest being "created o the fly" by the decoder.</p>
]]></description><link>https://forum.qt.io/post/662896</link><guid isPermaLink="true">https://forum.qt.io/post/662896</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 01 Jun 2021 19:30:57 GMT</pubDate></item><item><title><![CDATA[Reply to Blackscreen when using void QMediaPlayer::setVideoOutput(const QVector&lt;QAbstractVideoSurface *&gt; &amp;surfaces) on Tue, 01 Jun 2021 13:19:56 GMT]]></title><description><![CDATA[<p dir="auto">Hi thanks for your reply!!</p>
<p dir="auto">I converted the image using ffmpeg into YUV420p, which unfortunatly doesn't work. (isVideoAvailable:  false, DirectShowPlayerService::doRender: Unresolved error code 0x80040266 ()). Do you know another way to play Videos in Sync ? How about using QThreads or QtConcurrent ?</p>
]]></description><link>https://forum.qt.io/post/662827</link><guid isPermaLink="true">https://forum.qt.io/post/662827</guid><dc:creator><![CDATA[kk17baba]]></dc:creator><pubDate>Tue, 01 Jun 2021 13:19:56 GMT</pubDate></item><item><title><![CDATA[Reply to Blackscreen when using void QMediaPlayer::setVideoOutput(const QVector&lt;QAbstractVideoSurface *&gt; &amp;surfaces) on Mon, 31 May 2021 19:09:28 GMT]]></title><description><![CDATA[<p dir="auto">Hi and welcome to devnet,</p>
<p dir="auto">Any chance that your video returns YUV images ? If memory serves well that format is currently only rendered in QtQuick.</p>
<p dir="auto">On a side note, there's no need to allocate QList objects on the heap.</p>
]]></description><link>https://forum.qt.io/post/662679</link><guid isPermaLink="true">https://forum.qt.io/post/662679</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 31 May 2021 19:09:28 GMT</pubDate></item></channel></rss>