Results 1 to 7 of 7

Thread: Not able to play Videos with QMediaPlayer and QVideoWiget in Qt 5.2

  1. #1
    Join Date
    Dec 2010
    Posts
    44
    Thanks
    9
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Not able to play Videos with QMediaPlayer and QVideoWiget in Qt 5.2

    Hi,

    I have been trying to play video formats *.wmv, *.mp4 with QMediaPlayer and QVideoWidget in Qt5.2. I just followed the expample and here is my code:

    Qt Code:
    1. mp =new QMediaPlayer(this);
    2. vw = new QVideoWidget(this);
    3. QMediaPlaylist* playlist = new QMediaPlaylist(this);
    4. playlist->addMedia(QUrl::fromLocalFile("C:/Users/Public/Videos/Sample Videos/Wildlife.wmv"));
    5. playlist->setCurrentIndex(1);
    6. mp->setPlaylist(playlist);
    7. mp->setVideoOutput(vw);
    8. setGeometry(100,100,400,500);
    9. vw->setGeometry(0,0,300,400);
    10. show();
    11. play();
    To copy to clipboard, switch view to plain text mode 

    I have installed the K-Lite codecs. When I play the same files using Media Player Classic or Win Media Player the files play well and the the Lca and FFmpeg icons show up in the tray.

    But with Qt 5.2 I am not able to see any visuals for any video file. Only for wmv files I am able to hear audio(no visual).

    I have searched a lot on the web and everybody points to codecs which I believe I have. Does the configuration of the K-Lite codecs matter? I have used the default codecs. I have built Qt with the Win media foundation too. So I am at a loss to understand what is wrong here. Platform is win7 32.
    Any help is appreciated. Do let me know if I have to reading anything or any article or blog. Thank you.

  2. #2
    Join Date
    Mar 2010
    Posts
    86
    Thanks
    11
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Not able to play Videos with QMediaPlayer and QVideoWiget in Qt 5.2

    The question is what compiler with Qt 5.2.1 are you using? Opening just .AVI video? you're using MinGW. Opening other formats, use VS2012.
    I have mine doing .MOV, .AVI, .MP4 working with VS2012 64 bit and 32 bit. While .AVI working with MinGW.
    think your issue is that the VS2012 and VS2010 have DirectX Support, while I believe that MinGW doesn't.
    Have to say out of the box video without Phonon manual configuring is nice.
    oh I use Qt 5.2.0 Windows 8.1 haven't tried it in Ubuntu or Mac land yet
    Last edited by budda; 30th January 2014 at 16:31.

  3. #3
    Join Date
    Dec 2010
    Posts
    44
    Thanks
    9
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Not able to play Videos with QMediaPlayer and QVideoWiget in Qt 5.2

    Hi Budda,

    Thanks for the reply.
    The compiler is MSVC++ 2010. I have been using the same platform, same compiler, codecs with 4.8.5. And it works all well.
    Now I am trying to move to Qt5.2. And I am facing this problem. The problem is with all formats. Only with wmv files I am able to hear the audio.

    Sky.

  4. #4
    Join Date
    Mar 2010
    Posts
    86
    Thanks
    11
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Not able to play Videos with QMediaPlayer and QVideoWiget in Qt 5.2

    off hand, I'd say that to install it in with 4.8 you did all the extra stuff like DirectX SDK and such. I have my 4.8 on a virtual machine, so my Qt5.2 install is fresh on my current OS and my VS is Pro not Express.
    So it might be a VS2010 issue or a combined VS2010 with DirectX SDK issue. I would install 5.2 on another machine or in it's own virtual machine.... virtual box is free.. I do have sound working in 5.2 with VS2012 wouldn't think VS2010 wouldn't be supported...


    Added after 7 minutes:


    sadly though, I should mention that sound isn't supported in virtual box and every time it tries to play anything, you get a pop up message saying that the pins arent' connected... I use my virtual machine in 4.8 for development only and then move the software to another machine for useage.


    Added after 4 minutes:


    Plus don't you have environment variables for DirectX SDK for Qt4.8 ? Maybe this is in conflict with 5.2 install... I would seriously install on an OS that doesn't have an older version of Qt on it. Especially one that has Phonon configured on it.
    Last edited by budda; 30th January 2014 at 17:12.

  5. #5
    Join Date
    Dec 2010
    Posts
    44
    Thanks
    9
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Not able to play Videos with QMediaPlayer and QVideoWiget in Qt 5.2

    Hi Budda,

    I do not think this has got anything to do with the MSVC compilers. I just hope somebody who has faced a similarly problem to post their solution.

    Sky.

  6. #6
    Join Date
    Mar 2010
    Posts
    86
    Thanks
    11
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Not able to play Videos with QMediaPlayer and QVideoWiget in Qt 5.2

    I'm just saying that you are trying to install 5.2 when that OS is set up for 4.8 most likely Phonon and phonon-backend configuration. Plus to properly install that (4.8) you had to have VS Pro version of 2010 or 2008 (it will build but not work with Express)... And then the DirectX SDK and the VS SDK update patch for Qt. Installing Qt 5.2 on a fresh OS, and it does video out of the box after install. Plus video codex of course. If you're having that bad of problems playing video files & sound with 5.2 installed on a previous and current 4.8 install, the 4.8 install might be the issue with the 5.2 Put 5.2 on a laptop or another machine and see if you still have sound/playback issues.


    Added after 28 minutes:


    so your 4.8 phonon-backend video playback sink is installed on that machine through the DirectX and specified as the video sink, installing Qt 5.2 which doesn't use phonon or phonon-backend DirectX configuration would cause serious problems if it was trying to call a video playback sink.... Phonon did audio through the read/write file I/O so that's probably why it works with just .WMV or works at all. I'm sure 5.2 still uses DirectX in some way and the 4.8 install is still taking precedence since there's like a bunch of environment path items for 4.8 (C:\Program Files\Microsoft DirectX SDK (June 2010);C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin; for example) plus the DXSDK_DIR variable itself , so it is trying to use the 4.8 phonon-backend sinks and therefore no video playback. Since 4.8 is kinda a pain to set up for phonon, don't uninstall it... i would again just install 5.2 on a fresh OS.
    Last edited by budda; 1st February 2014 at 03:04.

  7. #7
    Join Date
    Dec 2010
    Posts
    44
    Thanks
    9
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Not able to play Videos with QMediaPlayer and QVideoWiget in Qt 5.2

    Hi All,

    I changed the video card to Nvidia GeForce 210 which supports OpenGL 3.3. My previous one supported only OpenGl 1.1. Qt5 on windows needs cards that support OpenGL 2.1 or greater. Now I am able to play all wmv videos properly but for any other format I get the following error: DirectShowPlayerService::doRender: Unresolved error code 80040266. VFW_E_NO_TRANSPORT Pins cannot connect because they don't support the same transport. For example, the upstream filter might require the IAsyncReader interface, while the downstream filter requires IMemInputPin. Do I have to build directshow or Qt5 after changing the video card?


    Added after 35 minutes:


    Hi All,

    It was the video card. It needed a video card that supports OpenGL Version 2.1 or more. Once I upgraded the video card to GeForce 210 which supports OpenGL 3.3 and installed the default K-Lite Codecs I was able to play all videos and audio.

    Sky.
    Last edited by sky; 5th February 2014 at 13:54.

Similar Threads

  1. Mediaplayer Youtube videos
    By madrich in forum Qt Programming
    Replies: 0
    Last Post: 6th March 2013, 14:28
  2. [Tab play list]Load play lists on start
    By petrusPL in forum Qt Programming
    Replies: 0
    Last Post: 18th March 2011, 18:12
  3. How to play youtube videos in Symbian device
    By prajnaranjan.das in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 2nd February 2011, 12:45
  4. How to play various media formats in Qmediaplayer
    By S P in forum Qt Programming
    Replies: 0
    Last Post: 1st June 2010, 13:28
  5. Qt::WA_TranslucentBackground and videos headache.
    By Smokex in forum Qt Programming
    Replies: 0
    Last Post: 17th March 2010, 18:40

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.