Results 1 to 20 of 20

Thread: can't see a video play but only music in Qt

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2010
    Posts
    137
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    9

    Default can't see a video play but only music in Qt

    Hi,

    I want to play a video in my application. But whenever I try to runt he application, I get the message "WARNING: Phonon::createPath: Cannot connect Phonon::MediaObject ( no objectName ) to Phonon::VideoWidget ( no objectName )." And I can hear the music but not video. Here is my code

    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. ui->setupUi(this);
    6. Phonon::VideoPlayer *player =
    7. new Phonon::VideoPlayer(Phonon::VideoCategory, this);
    8. player->play(QUrl("path"));
    9. player->show();
    10. }
    11.  
    12. #include <QMainWindow>
    13. #include <phonon/VideoPlayer>
    14. #include <phonon/backendcapabilities.h>
    15. #include <QUrl>
    16. #include <phonon>
    17. namespace Ui {
    18. class MainWindow;
    19. }
    20.  
    21. class MainWindow : public QMainWindow
    22. {
    23. Q_OBJECT
    24.  
    25. public:
    26. explicit MainWindow(QWidget *parent = 0);
    27. ~MainWindow();
    28.  
    29. private:
    30. Ui::MainWindow *ui;
    31. };
    To copy to clipboard, switch view to plain text mode 

    I tried to run the code from http://www.qtcentre.org/threads/3048...w-black-screen but didn't work. Can any one please tell me what else should be required to play a video.

    Thank You,
    Baluk
    Last edited by baluk; 8th October 2010 at 14:30.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 268 Times in 268 Posts
    Wiki edits
    20

    Default Re: can't see a video play but only music in Qt

    You have the correct decoder installed?

  3. #3
    Join Date
    Jun 2010
    Posts
    137
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    9

    Default Re: can't see a video play but only music in Qt

    I am sorry but what decoder I should use. I thought Qt takes the default one that is provided in my windows vista, isn't it so. I don't have much idea about decoder stuff I am trying to find it anyway.

    Thank You,
    Baluk

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: can't see a video play but only music in Qt

    Unless you have a codec capable of playing the video, all you'll get is audio.

    We can't tell you which decoder to use as we don't know your file format.

  5. #5
    Join Date
    Jun 2010
    Posts
    137
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    9

    Default Re: can't see a video play but only music in Qt

    I want to play avi, mp3 and mkv format file.

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: can't see a video play but only music in Qt

    avi and mkv are only containers, what is the file type that you will be playing inside those containers? eg. xvid.

  7. #7
    Join Date
    Jun 2010
    Posts
    137
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    9

    Default Re: can't see a video play but only music in Qt

    oke. File type is VLC media file.

  8. #8
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: can't see a video play but only music in Qt

    No, it's not.

    That's just the registered player you are using to play the file.

  9. #9
    Join Date
    Jun 2010
    Posts
    137
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    9

    Default Re: can't see a video play but only music in Qt

    Oke. Now I got to understand what is file format. I want to play avc1 and MPGV codec files.

  10. #10
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: can't see a video play but only music in Qt

    Install FFDShow

  11. #11
    Join Date
    Jun 2010
    Posts
    137
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    9

    Default Re: can't see a video play but only music in Qt

    I have it installed on my system. My audio was playing with this codec support only.

Similar Threads

  1. play a video from youtube
    By graciano in forum Qt Programming
    Replies: 2
    Last Post: 13th July 2011, 08:17
  2. How to reverse play a video with phonon
    By Markus in forum Qt Programming
    Replies: 1
    Last Post: 19th July 2010, 07:48
  3. Qt phonon is only giving black screen when i play the video.what can be the soluition
    By savaliya_ambani in forum Qt for Embedded and Mobile
    Replies: 6
    Last Post: 3rd July 2010, 14:09
  4. Play video file with Phonon and GStreamer show black screen
    By SimbadSubZero in forum Qt Programming
    Replies: 2
    Last Post: 6th May 2010, 12:47
  5. Play video in QT4 application
    By carlosmele in forum Qt Programming
    Replies: 3
    Last Post: 14th April 2009, 23:24

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
  •  
Qt is a trademark of The Qt Company.