Results 1 to 20 of 20

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

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

    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 13:30.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    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
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    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
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    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
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    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
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    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
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    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
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    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
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    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
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

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

    Install FFDShow

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

    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.

  12. #12
    Join Date
    Oct 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

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


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

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

    So according to the link, I can't play a video using Qt 4.7. Is there any other way I could make it possible.

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

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

    I moved to Qt 4.6.2 and tried to run my application. But I still couldn't succeed. Here I am copying my code. Could any one please check If it is running on your system.

    Qt Code:
    1. #include <QMainWindow>
    2. #include <phonon/VideoPlayer>
    3. #include <phonon/VideoWidget>
    4. #include <phonon/backendcapabilities.h>
    5. #include <QUrl>
    6. #include <phonon>
    7. namespace Ui {
    8. class MainWindow;
    9. }
    10.  
    11. class MainWindow : public QMainWindow {
    12. Q_OBJECT
    13. public:
    14. MainWindow(QWidget *parent = 0);
    15. ~MainWindow();
    16.  
    17. protected:
    18. void changeEvent(QEvent *e);
    19.  
    20. private:
    21. Ui::MainWindow *ui;
    22. };
    23.  
    24. #endif // MAINWINDOW_H
    25.  
    26. //.CPP file
    27.  
    28. MainWindow::MainWindow(QWidget *parent) :
    29. QMainWindow(parent),
    30. ui(new Ui::MainWindow)
    31. {
    32. ui->setupUi(this);
    33.  
    34. qDebug() << Phonon::BackendCapabilities::availableAudioOutputDevices();
    35.  
    36. Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);
    37.  
    38. Phonon::VideoWidget *videoWidget = new Phonon::VideoWidget(this);
    39. Phonon::createPath(mediaObject, videoWidget);
    40.  
    41. Phonon::AudioOutput *audioOutput =
    42. new Phonon::AudioOutput(Phonon::VideoCategory, this);
    43. Phonon::createPath(mediaObject, audioOutput);
    44. mediaObject->setCurrentSource(QUrl("file.mkv or .avi"));
    45. connect(mediaObject, SIGNAL(finished()), mediaObject, SLOT(deleteLater()));
    46. mediaObject->play();
    47.  
    48. }
    49.  
    50. MainWindow::~MainWindow()
    51. {
    52. delete ui;
    53. }
    54.  
    55. void MainWindow::changeEvent(QEvent *e)
    56. {
    57. QMainWindow::changeEvent(e);
    58. switch (e->type()) {
    59. case QEvent::LanguageChange:
    60. ui->retranslateUi(this);
    61. break;
    62. default:
    63. break;
    64. }
    65. }
    66.  
    67. //.pro file
    68.  
    69. #-------------------------------------------------
    70. #
    71. # Project created by QtCreator 2010-10-10T23:15:17
    72. #
    73. #-------------------------------------------------
    74.  
    75. QT += opengl phonon multimedia
    76.  
    77. TARGET = video
    78. TEMPLATE = app
    79.  
    80.  
    81. SOURCES += main.cpp\
    82. mainwindow.cpp
    83.  
    84. HEADERS += mainwindow.h
    85.  
    86. FORMS += mainwindow.ui
    87.  
    88. wince*{
    89. DEPLOYMENT_PLUGIN += phonon_ds9 phonon_waveout
    90. }
    To copy to clipboard, switch view to plain text mode 

    Thank You,
    baluk

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

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

    Hi,

    My problem is solved. Now I can play a video in my Qt app. It was solved when I enable the corresponding decoder in the ffdshow video decoder ( which is responsible for all format video play). Before I was overlooked the issue when running the application.

  16. #16
    Join Date
    Nov 2010
    Posts
    48
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

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

    Quote Originally Posted by baluk View Post
    Hi,

    My problem is solved. Now I can play a video in my Qt app. It was solved when I enable the corresponding decoder in the ffdshow video decoder ( which is responsible for all format video play). Before I was overlooked the issue when running the application.
    Hi,
    I am new to Qt and facing the same issue. I am using windows XP and also install k-Lite codec, but still not working, then I uninstalled that and installed FFDSHOW, do I need to configure anywhere in my system. Please suggest me.

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

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

    Did you open the ffdshow window and check the available video types and if they are enabled or disabled.

  18. #18
    Join Date
    Nov 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

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

    I tried to play DIVX encoded .avi file. But it is not playing. I have also installed ffdshow and I have checked that DIVX XIDV codecs are enabled. Can somebody help me.

  19. #19
    Join Date
    Dec 2010
    Location
    Ukraine, Kharkiv
    Posts
    17
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

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

    Quote Originally Posted by baluk View Post
    Hi,

    My problem is solved. Now I can play a video in my Qt app. It was solved when I enable the corresponding decoder in the ffdshow video decoder ( which is responsible for all format video play). Before I was overlooked the issue when running the application.
    Can you write, where and what did you do to see video?

  20. #20
    Join Date
    May 2013
    Posts
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Windows

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

    can anybody tell me in ffdshow video decoder what option shud i enable for playing .avi video file.I can only hear the music but no video........

Similar Threads

  1. play a video from youtube
    By graciano in forum Qt Programming
    Replies: 2
    Last Post: 13th July 2011, 07:17
  2. How to reverse play a video with phonon
    By Markus in forum Qt Programming
    Replies: 1
    Last Post: 19th July 2010, 06: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, 13: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, 11:47
  5. Play video in QT4 application
    By carlosmele in forum Qt Programming
    Replies: 3
    Last Post: 14th April 2009, 22: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.