Results 1 to 3 of 3

Thread: Playing MP4 and FLV with QMediaPlayer

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Playing MP4 and FLV with QMediaPlayer

    Good day everyone!

    background info
    All machines mentioned below are Win 7 Pro
    Using Qt 5.0.2

    I am trying to do as the title says, I am using the QMediaPlayer and QVideoWidget to try and play video.

    Here is the code:
    Qt Code:
    1. //should be noted that mp4 are encoded with h264
    2. QUrl filename = QUrl::fromLocalFile("sampleFile.mp4");
    3. QMediaPlayer *mMediaPlayer = new QMediaPlayer();
    4. QVideoWidget *mVideoWidget = new QVideoWidget(this);
    5.  
    6. this->setCentralWidget(mVideoWidget); //where this is the mainwindow
    7.  
    8. mMediaPlayer->setMedia(filename);
    9.  
    10. qDebug() << "Player error state -> " << mMediaPlayer->error(); //this says no error
    11. qDebug() << "Media supported state -> " << QMediaPlayer::hasSupport("video/mp4"); // this gives a "1"
    12.  
    13. this->show();
    14. mMediaPlayer->play();
    To copy to clipboard, switch view to plain text mode 
    The trick is this, I can put this on several different machines — all are Windows 7 Pro:
    1.) machine 1 — development box, can play some mp4s but not others (all h264)
    2.) machine 2 — personal household box, will play the sampleFile mp4 sometimes
    3.) machine 3 — COMPLETELY clean windows 7 pro install, aside from the code above, has nothing installed on it, NEVER plays the mp4.

    All 3 machines can play the sampleFile.mp4 in Windows Media Player.

    As a final note, none of these will play FLV either.

    Pointers anyone? What am I missing here?
    Last edited by JasonKretzer; 11th September 2013 at 21:51. Reason: updated contents

Similar Threads

  1. QMediaPlayer Questions
    By morpheus in forum Newbie
    Replies: 1
    Last Post: 25th August 2013, 14:03
  2. QMediaplayer setposition is wrong
    By oldkkk2008 in forum Qt Programming
    Replies: 1
    Last Post: 11th March 2013, 10:58
  3. QMediaPlayer problems
    By alenn.masic in forum Qt Programming
    Replies: 1
    Last Post: 25th February 2013, 15:32
  4. QMediaPlayer repeat sound
    By alenn.masic in forum Qt Programming
    Replies: 0
    Last Post: 21st February 2013, 14:46
  5. QMediaPlayer seeking in stream
    By n1ghtly in forum Qt Programming
    Replies: 0
    Last Post: 24th August 2012, 13:28

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.