Page 1 of 2 12 LastLast
Results 1 to 20 of 39

Thread: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

  1. #1
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    I want to a non-GUI application play on the background ( not from a player ). So with this command

    Qt Code:
    1. canberra-gtk-play -f /home/babulas/Desktop/1.ogg
    To copy to clipboard, switch view to plain text mode 

    i can play only ogg and wav files... Is there any way so i can play all the audio types i mention before ( MP3,WAV,OGG,FLAC,MP4,M4A ) ? I have heard about SDL Libraries but for QtAudioOutput as well... What do you suggest to me and please tell me how to do it... Thanx anyway..!

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    Clearly, nothing in Qt has much to do with the GTK application or SDL you refer to in the post. Read the Phonon Overview in Assistant and judge for yourself whether Qt can be used to do what you want. You will want to install the relevant GStreamer modules on your Linux machine to support other formats. On Windows I assume you get access to whatever can be played by the codecs installed on the system.

  3. The following user says thank you to ChrisW67 for this useful post:

    hakermania (31st August 2010)

  4. #3
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    Ok i had read the phonon review.. But nowhere it says the exact function to open those audio files... Could anybody just tell me what libraries should i download and how to make all this work? :/

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    I have a suggestion... Install every every possible package in your distribution. Then you'll know for sure that you have installed those required ones as well. And while it is all installing, please read Phonon Overview again, especially the "Playback" and "Installing Phonon" sections. If you have some specific questions afterwards, come back here and ask them.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    hakermania (31st August 2010)

  7. #5
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    I have installed the libraries you know.... But i couldn't include phonon... AND.. i had seen the playback but because i cannot include Phonon it says that phonon is not a type name...

  8. #6
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    No You didn't fallow advice given to You by wysota, because there is IDENTICAL example explaining HOW TO do EXACTLY what You want in examples directory.
    See qtDir/examples/phonon/qmusicplayer.

  9. The following user says thank you to Talei for this useful post:

    hakermania (31st August 2010)

  10. #7
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    I would also wanted to play a sound file in my app. It sounds very cool. Unfortunately the example doesn't work...

  11. #8
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    WinXp, qt 4.6.3, build it right now on debug, everything works (ogg, wav, mp4, ... ). So I don't know what doesn't work for You, mostly because You didn't say where the problem lies.
    Phonon uses backends, for Win - DirectShow, for Lin GStreamer, MacS QuickTime. If Your application build successful and You don't see wideo, hear sound that means that You don't have appropriate codec in Your system. (use Phonon::ErrorState to determine what's wrong)
    Most problem on windows came from the ffdshow codec installed. I personally use K-Lite codec pack, because they works pretty well with phonon/wmp.

  12. The following user says thank you to Talei for this useful post:

    hakermania (31st August 2010)

  13. #9
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    Think that hakermania and me have Unix as i can see from his logo...

  14. #10
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    @Bong.Da.City search synaptic for phonon and in the quixk search type library. install all the packages except for them that say perl.

    @public Ok, I installed the proper packages and now it compiled fine, but it doesn't play MP3. It does play WAV and OGG properly but it cannot play MP3......

  15. #11
    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: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    Most media formats are NOT free.
    If you have OpenSuse for example, NON of these (the non free ones I mean) will play, even with everything correctly installed.

    You just miss the necessary codecs.
    On how to install those, check google, or your distro help channels.

  16. The following user says thank you to tbscope for this useful post:

    hakermania (31st August 2010)

  17. #12
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    Sorry, nut you are wrong. I've installed the correct codecs. All of my other players do play MP3

  18. #13
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    Quote Originally Posted by Bong.Da.City View Post
    Think that hakermania and me have Unix as i can see from his logo...
    From my experience Phonon works better on "Unix" then on Windows. I wrote player that streams video from the site (audio/video) and it works perfect on Linux, on Windows there is nightmare with DS codec.

    I tested example with:
    Distributor ID: Ubuntu
    Description: Ubuntu 10.04.1 LTS
    Release: 10.04
    Codename: lucid

    Qt 4.6.3
    and
    Distributor ID: Debian
    Description: Debian GNU/Linux testing (squeeze)
    Release: testing
    Codename: squeeze

    Qt 4.6.2
    As tbscope said some codecs are "close source" and thus not included in "Unix" by default. AFAIK there is no way to play wmav2 (vma8) on NIX, but I can be wrong on this one. Rest is probably in "bad" or "ugly" package.

  19. The following user says thank you to Talei for this useful post:

    hakermania (31st August 2010)

  20. #14
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    But as i said (see screenshot) I've install the codecs.....

  21. #15
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    hakermania try:
    gstreamer0.10-ffmpeg
    gstreamer0.10-fluendo-mp3
    gstreamer0.10-plugins-ugly
    Those (ugly) are so called restricted format, that's why they are not included by default.

  22. #16
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    All already installed







  23. #17
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    I installed these and everything works fine for me, so problem is with Your codec/system. You probably should ask question in Ubuntu forum about this.

  24. #18
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    Same problem here... I finally managed tto install phonon and compile the application... Thanks to hakermania.. Anyway it doesn't play mp3 files.. I also have those packets you mentioned before....

    gstreamer0.10-ffmpeg
    gstreamer0.10-fluendo-mp3
    gstreamer0.10-plugins-ugly

  25. #19
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    Can you play those mp3 files using pure gstreamer? Please also note that Phonon requires particular version of gstreamer (as mentioned in the docs).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  26. #20
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to play MP3,WAV,OGG,FLAC,MP4,M4A ?

    Yeah. I can listen to mp3 files through pure gstremer. So, Phonon has a lot of dependencies as I understood. This means that it is not so useful because users that will use my app would have to download and install all these packages in order to Phonon to work, right?... How about using QAudioOutput? What does it support?

Similar Threads

  1. Play .amr sound
    By ahmdsd_ostora in forum Qt Programming
    Replies: 3
    Last Post: 17th July 2010, 16:34
  2. play audio url
    By tungvc in forum Qt Programming
    Replies: 0
    Last Post: 15th July 2010, 12:04
  3. qmake flac
    By rubenvb in forum Qt Programming
    Replies: 0
    Last Post: 8th November 2009, 16:18
  4. To Play Movie in QT 4
    By Isa in forum Qt Programming
    Replies: 8
    Last Post: 2nd August 2008, 12:56
  5. QPicture does not play right
    By derick in forum Qt Programming
    Replies: 5
    Last Post: 19th February 2006, 02:46

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.