Nominate our 2022 Qt Champions!

QMediaPlayer and two seperate Streams

  • Hi at all,
    i have two seperates byte streams, one for audio and one for video. Now i want to use the QMediaPlayer for playback. Do i need to use two instances of the player? Because QMediaPlayer::setMedia suppors only one stream. And if i need to do this, how can I ensure that both streams are sync together?

  • Lifetime Qt Champion


    AFAIK, you should do the "mixing" before you try to use QMediaPlayer.

    By the way, what OS are you running on ?

  • @SGaist thx for the fast answer,

    my OS is superficial Windows, but a further port or usage on Linux is possible.

    Ok so my usecase isn't practical ? Then i add a muxing "block" in my video processing line. Thank you

  • Lifetime Qt Champion

    Are you writing a QtMultiMedia backend or "just" a media object ?

  • @SGaist Thx again,

    let me give you some more details:

    there are two programms:
    server and client

    Die client request the server for a "stream" or multiple streams.
    The server grab the information from different devices and creates one or multiple video streams. But only one audio stream. There also some image processing and encoding (h264/h265) in the server pipeline. The client receive this streams ... decode them and should display them. Maybe there is also some image processing after the decoding. So that the "Qt part" get the decoded and processed frames and audio signals.

    Following picture is showing from Qt side:

    • Videostream 1
    • Audiostream 1
    • Videostream 2
    • Videostream N

    Videostream 1 and Audiostream1 should be play together. The following streams has no audio input. The idea was to play each videostream in a dockwidget to seperate the window on a other monitor and each videostream has it's own QMediaPlayer.
    Your submission with the mix of audio and video before the playback ist useful, for that reason alone of sync these both.

    i hope that help you to understand my problem.

  • Lifetime Qt Champion

    Yes it's clearer.

    Then you should indeed do the synchronization at the source, it will be cleaner and easier.

Log in to reply