Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-94149

"Failed to activate video surface" with QGraphicsVideoItem, QMediaPlayer

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Component/s: Multimedia
    • Labels:
      None
    • Environment:
      macOS 10.14
    • Platform/s:
      macOS

      Description

      I'm writing a media presenter program, it plays, among other things music videos.

      I have 3 QGraphicsScene}}s in different windows (not the same scene, but currently always shows the same things). 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" (frame-by-frame animated bitmap graphics) into a QPixmap then send it into the videoItem for presentation), OR it may be generated by a QMediaPlayer presenting "Movie" frames directly into the VideoItem. Note that either way, the items are presented into a vector of {{QAbstractVideoSurface}}s, 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 video are playing at the same time. (the front one is animating opacity to reveal the back one)

      Works fine MOST of the time. And more often works with transition types CDG->CDG or Movie->Movie, or even Movie->CDG. But if i transition from CDG->Movie, inevitably i get "Failed to activate video surface". Note that it still happens occasionally no matter what the transition types are, but almost ALWAYS with the last one.

      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. I have tested with this option off, it didn't help.

      I suppose you'd reproduce it by starting with the "VideoGraphicsItem" example, have it auto-load a long mp4 file, and start playing it. then while that is playing, after a short delay, have it create a new QGraphicsVideoItem that updates a QPixmap on a timer to start presenting frames into its item in the scene.

      I have an app you can use to see the issue, and i am happy to add any logging that will give you any info you need, but the app is monumental and it takes days to set up a dev environment that would build it.  i CAN give you remote desktop access to the dev machine so you CAN catch it in the debugger, but that machine does NOT have qt sources locally compiled (using the installer qt library binaries). i'd be OH SO HAPPY to compile the Qt Libraries locally, just haven't been able to yet.

      link to original forum discussion

      Update: it's not directly related to mixing types of graphics items. one time in ten (or so) it will happen just by playing an mp4. the error (UnsupportedFormatError) is only recorded on the abstract video surface (you can call surfaceP->error() to see it), it is treated as a warning, not an error, and is not reported back to the calling app (even if i set up a signal handler for QMediaPlayer::error, it is never called)

      you can see in avfvideorenderercontrol.mm, search for "Failed to activate video surface", you'll see that it just issues a warning and it doesn't log enough info to find out WHY it failed.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            valentyn.doroshchuk Valentyn Doroshchuk
            Reporter:
            davecotter David M. Cotter
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes