Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt qml mediaplayer not playing mp4



  • I am trying to play a mp4 video in MediaPlayer

    MediaPlayer {
        id: mediaPlayer
        loops: Audio.Infinite
        source: "file:///c:/Users/Dan/Videos/Exercise Videos/Autumn Forest.mp4"
        onPlaying: console.log("Video playing", playbackState)
        muted: true
        onError: console.log("ScenarioView::MediaPlayer::onError() - error=" + error + ", errorString=" + errorString)
    }
    
    VideoOutput {
        fillMode: VideoOutput.PreserveAspectCrop
        source: mediaPlayer
        visible: hasVideo && settings.isVideoMode
        anchors.fill: parent
    }
    

    output:
    qml: Video playing 1
    libpng warning: iCCP: known incorrect sRGB profile
    libpng warning: iCCP: known incorrect sRGB profile
    libpng warning: iCCP: known incorrect sRGB profile
    DirectShowPlayerService::doRender: Unresolved error code 0x80040266 ()
    qml: ScenarioView::MediaPlayer::onError() - error=1, errorString=

    It seems to be going in the onPlaying I am getting
    PlayingState - the media is currently playing.
    but I can't see the video
    Does anybody have a idea why I can't see the video
    Also I have trying this on different versions of qt



  • @dspelt Hi. Actually you didnt start your mp4 video. Just trigger it with a button simply. It will work:

    Button{
            onClicked: {
                mediaPlayer.play()
            }
        }
    


  • AFAIK on Windows DirectShow doesn't support mp4 out of box. Probably you need to install 3rd party codecs into your system. Usually installing k-lite codec pack solves the problem.


Log in to reply