Results 1 to 20 of 39

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

Hybrid View

Previous Post Previous Post   Next Post Next Post
  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)

Similar Threads

  1. Play .amr sound
    By ahmdsd_ostora in forum Qt Programming
    Replies: 3
    Last Post: 17th July 2010, 15:34
  2. play audio url
    By tungvc in forum Qt Programming
    Replies: 0
    Last Post: 15th July 2010, 11:04
  3. qmake flac
    By rubenvb in forum Qt Programming
    Replies: 0
    Last Post: 8th November 2009, 15:18
  4. To Play Movie in QT 4
    By Isa in forum Qt Programming
    Replies: 8
    Last Post: 2nd August 2008, 11:56
  5. QPicture does not play right
    By derick in forum Qt Programming
    Replies: 5
    Last Post: 19th February 2006, 01: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.