Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Playing MP4 and FLV with QMediaPlayer
Forum Updated to NodeBB v4.3 + New Features

Playing MP4 and FLV with QMediaPlayer

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 901 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JasonKretzer
    wrote on last edited by
    #1

    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:
    @
    //should be noted that mp4 are encoded with h264
    QUrl filename = QUrl::fromLocalFile("sampleFile.mp4");
    QMediaPlayer *mMediaPlayer = new QMediaPlayer();
    QVideoWidget *mVideoWidget = new QVideoWidget(this);

    this->setCentralWidget(mVideoWidget); //where this is the mainwindow

    mMediaPlayer->setMedia(filename);

    qDebug() << "Player error state -> " << mMediaPlayer->error(); //this says no error
    qDebug() << "Media supported state -> " << QMediaPlayer::hasSupport("video/mp4"); // this gives a "1"

    this->show();
    mMediaPlayer->play();
    @

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved