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

Embedding Mplayer into Qt Media Player



  • hello!
    I would like to watch an avi file in Qt through Mplayer.
    I have Qt 5.5 and using Mplayer for windows.
    this is my code:
    int main(int argc, char *argv[])
    {

    QApplication a(argc, argv);
    a.setAttribute(Qt::AA_NativeWindows, true);
    Dialog w;
    w.show();
    
    QWidget *player;
    QStringList arguments;
    QProcess *m_pProcessVideo;
    m_pProcessVideo = new QProcess(0);
    player = new QWidget(0);
    //QMediaPlayer* player = new QMediaPlayer;
    
    
    QString winNuber = QString ::number((int) (player->winId()));
    arguments << "-slave" << "-wid" << winNuber << "-vo" << "directx:noaccel" << "-fs" << "C:\\Program Files (x86)\\MPlayer for Windows\\MVI_1343.avi" ;
    m_pProcessVideo->start("C:\\Program Files (x86)\\MPlayer for Windows\\mplayer.exe",arguments);
    return a.exec();
    

    }

    The movie is played-I can hear the sound though can't see anything..I think it's the arguments that are wrong. What are the right arguments?
    Thanks.


Log in to reply