Important: Please read the Qt Code of Conduct -

QMediaPlayer fails on windows?

  • i have a cross platform app, and it works great on mac, but on windows i get this error:
    0_1503984952143_Screen Shot 2017-08-28 at 10.28.35 PM.png
    for your enjoyment, here's the code that's executing:
    0_1503984971777_Screen Shot 2017-08-28 at 10.26.41 PM.png
    i have confirmed that the media file exists on windows, here's the variables panel:
    0_1503985007406_Screen Shot 2017-08-28 at 10.27.33 PM.png
    Any thoughts?
    windows 10, all current updates.

  • Qt Champions 2019

    @davecotter You can check Qt bug tracker. Maybe this is a known issue. Or you file a new bug.

  • @davecotter

    It is probably an error(0x80040266) because the codec for that video is not installed. First, install a free-codec like K-Lite and run your program.

  • @Devopia53 it's an mp4 (h.264) file, isn't that built into the OS?

  • Lifetime Qt Champion


    No it's not, h.264 is a proprietary codec with all the constraints that comes with it.

    However, it seems that since Windows 7 there's some form of support through DirectShow for decoding only.

    [edit: Added info based on MSDN SGaist]

  • there is a royalty-already-paid, free implementation by cisco, so it IS possible to include the binary with Qt

    and WMF does play h.264, so it is, in fact, built in to the system, just not in DirectShow

    has anyone figured out how to include a codec.dll with their app and have it "just work"? how did you do it?

    here's the bug by the way, which is marked "closed" :(. there is another version of this bug that is open, but it is low priority, and nobody has stepped up to take it on. double frowny face

  • Lifetime Qt Champion

    Including such a codec also means that you have to follow its development to keep it up to date, fix security holes etc. Then you also have to provide a way to replace it by one of the commercial alternative etc.

    You can't just include a dependency because it would be nice, there are a lot of consideration to take into account.

  • i'm aware there are limitations and challenges, and i'm willing to take those on for the benefit of my users.

    but what i'm looking for are solutions. does anyone have a working solution example ?

  • Qt Champions 2019

    @davecotter You should carefully read the License for this Cisco implementation before including and distributing it. Else (depending on the License conditions) you could get in troubles. I'm not lawyer and did not spend much time to read that license, but I'm really not sure it would be that easy to include it in Qt from licensing point of view. "Royalty already paid, free implementation" does NOT automatically mean you're allowed to distribute it with other software, especially open source. And don't forget that Qt is available as LGPL as well and I'm quite sure this Cisco license is NOT compatible with LGPL.
    This is the reason why Linux distributions usually do not include any proprietary codecs by default and user has to install them.
    This whole licensing topic is much more complex than many people think.

  • @davecotter

    If so, have you tested it with WMF-plugin instead of DirectShow-plugin? (If MSVC is installed.)

  • I'm resigned to the fact that the user will have to click to install some codec.dlls after they install my app. okay fine.
    but, so, i thought that was because h.264 was not handled by DirectShow?

    however, i just saw this:

    which leads me to believe that h.264 is in fact supposed to "just work" when using DirectShow.

    Am i misunderstanding something?

  • Qt Champions 2019

    @davecotter You really should check the Qt bug tracker. Your app should not crash because of missing/not working codec. There is definitely something wrong, could be a bug in Qt. You can file a bug report if there is nothing yet. Also you can ask on Qt developers mailing list - they know more about Qt internals.

  • i'm not crashing, just that h.264 gives that error in the debug log, which i totally did not expect, since it is the most modern format with hardware decoding available cross platform.

    and yes, i'm in on the bug reports that are tracking this.

    according to the MSDN document, h.264 is in fact a natively supported format for DirectShow, so that's why i'm confused.

  • Lifetime Qt Champion

    Going a bit further in the h.264 linked documents here and here, I'm not sure about full support for everything you can throw in such a video file although it would be very nice.

    Might be a silly question but can you play that file through Windows Media Player without any codec packs installed ?

  • yes, WMP can play h.264 files, but i'm not convinced that is a fair test, because WMP is quite savvy about choosing what back end to use to play the media you throw at it. Qt, on the other hand, is not.

Log in to reply