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

play .mp4 file in Qt creator



  • Re: How to play .mp4
    Hello,

    I am using qt creator version
    $qmake --version
    =>Using Qt version 5.5.1

    I have installed all gstreamer module
    and able to play .mp4 using $gst-play & $gst-launch command also

    while running on Qt creator output window get open but its not playing anything.
    output logs :
    =>QMediaPlayer::PlayingState
    Warning: "No decoder available for type 'video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)4, profile=(string)high, codec_data=(buffer)01640028ffe1001967640028acd100780227e5c04400000fa40003a9803c60c44801000468ebef2c, max-input-size=(int)116703, width=(int)1920, height=(int)1080, framerate=(fraction)30000/1001, pixel-aspect-ratio=(fraction)1/1'."
    Warning: "No decoder available for type 'audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)1210, max-input-size=(int)558, rate=(int)44100, channels=(int)2'."
    Error: "Your GStreamer installation is missing a plug-in.

    main.cpp
    =>#include "dialog.h"
    #include <QApplication>
    #include <QMediaPlayer>
    #include <QVideoWidget>
    #include <QDebug>

    int main(int argc, char argv[])
    {
    QApplication a(argc, argv);
    QMediaPlayer
    player =new QMediaPlayer;
    QVideoWidget* vw= new QVideoWidget;
    player->setVideoOutput(vw);
    player->setMedia(QUrl::fromLocalFile("samplevideo.mp4"));
    vw->setGeometry(100,100,300,400);
    vw->show();
    player->play();
    qDebug() <<player->state();
    return a.exec();
    }

    .pro file

    QT += core gui multimedia multimediawidgets
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    TARGET = video_play_file
    TEMPLATE = app
    SOURCES += main.cpp
    dialog.cpp
    HEADERS += dialog.h

    please verfiy my code.



  • @Pooja-Bhusare said in play .mp4 file in Qt creator:

    please verfiy my code.

    well, instead of verifying your code, you may need to verify your installation... see:

    Warning: "No decoder available for type 'audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)1210, max-input-size=(int)558, rate=(int)44100, channels=(int)2'."

    Error: "Your GStreamer installation is missing a plug-in.

    From Qt Multimedia documentation:

    The Qt Multimedia APIs build upon the multimedia framework of the underlying platform. This can mean that support for various codecs or containers can vary between machines, depending on what the end user has installed.

    As a side note,

    I am using qt creator version
    $qmake --version
    =>Using Qt version 5.5.1

    You may need to differentiate between Qt Creator (the IDE) and Qt framework, the libraries.
    You're showing the version of your Qt framework in use.
    For getting the Qt Creator version, Help -> About ...


  • Qt Champions 2019

    @Pablo-J-Rogina said in play .mp4 file in Qt creator:

    For getting the Qt Creator version, Help -> About ...

    First time I see it other way around :-) Usually people post what "Help -> About ..." says when asked about Qt version :-)


Log in to reply