Important: Please read the Qt Code of Conduct -

"Failed to activate video surface"

  • On mac, using 5.15.2.

    I have 3 QGraphicsScenes. In each scene I have one (or more but we'll get to that) layers of type QGraphicsVideoItem (plus a QGraphicsSimpleTextItem but that's probably not a factor).

    Now each that QGraphicsVideoItem may be generated by me (i paint "CDG" into a QPixmap then send it into the videoItem for presentation), OR it may be generated by a QMediaPlayer presenting "Movie" frames directly. Note that either way, the items are presented into a vector of QAbstractVideoSurfaces, cuz as i said there are 3 scenes.

    Normally there's only one video item, and all is well. But during transitions, there is a short window of crossfade, where the previous and next song are playing at the same time.

    Works fine MOST of the time. And more often when going from CDG->CDG or Movie->Movie, or even Movie->CDG. But if i transition from CDG->Movie, inevitably i get "Failed to activate video surface".

    I can't for the life of me figure out why.

    If you need, i can provide a debug app that exhibits this behavior.

    if it is relevant, i do have Qt::AA_ShareOpenGLContexts turned on.

  • Lifetime Qt Champion


    What if you nuke the CDG before the transition ?

  • then we don't get crossfade, which is a major feature of the app

  • note that i'm STILL getting "Failed to activate video surface" intermittently and sporadically, just that given the steps above i KNOW i can cause the bug very reliably. I figure if THAT bug is fixed, the sporadic bug is also fixed.

    I've not turned off Qt::AA_ShareOpenGLContexts because I need that for performance reasons, since the 3 scenes are in separate windows. But if you feel i should shut that off as a test to gather intel, i'll do so.

  • Lifetime Qt Champion

    How do you implement crossfade ?

  • by adding both layers to the scene, and animating the opacity of the top layer

  • Lifetime Qt Champion

    What if you duplicate the pixmap, nuke the CDG and do the crossfade using the duplicated pixmap ?

  • Well, that's not how my pipeline works. I appreciate your suggestion about that, but it would be a hack to try to do it that way. I'm not really looking for a hack or a workaround, I'm hoping for a bugfix or a true solution like "oh you forgot to set the fubar opengl bit here do this" kind of answer. :-)

    By the way, at transition time, the video that is the CDG is still playing, still animating, still presenting new frames through its QGraphicsVideoItem layer, while it is "fading out", it's not a static image. This happens while the mp4 video is also playing behind it, being revealed.

  • okay this is not related to order of ops or having two different types of graphics items.

    if i just play then stop then play, over and over, eventually it will cause the problem.

    yes it's hard to repro this way, but then sometimes, it happens every time i play, same file.

  • Lifetime Qt Champion

    Can you provide a minimal compilable example that shows this behaviour ?

    Does it happen with a specific file or any will do ?

Log in to reply