microsnakey
Posts: 11
Joined: Wed Jun 20, 2012 9:09 pm

Playing an mp3 stream with gstreamer

Wed Jul 25, 2012 9:17 pm

I am totally new to python and linux and want to receive an mp3 stream and play it.
Would gstreamer be the best for this, Is they any easier libraries to use

This is my code atm

Code: Select all

	
        player = gst.element_factory_make("playbin2","player")
	url = 'htttp://mp3channels.webradio.antenne.de/chillout'
	player.set_property('uri',url)
	player.set_state(gst.STATE_PLAYING)
	glib.MainLoop().run()
Thanks

microsnakey
Posts: 11
Joined: Wed Jun 20, 2012 9:09 pm

Re: Playing an mp3 stream with gstreamer

Wed Jul 25, 2012 10:58 pm

Infact using the official code its not even working.
Any other alternatives

microsnakey
Posts: 11
Joined: Wed Jun 20, 2012 9:09 pm

Re: Playing an mp3 stream with gstreamer

Thu Jul 26, 2012 8:58 pm

Right I used pygame to play my mp3, I can play local mp3's but I can't play a stream. Anyway around this?

microsnakey
Posts: 11
Joined: Wed Jun 20, 2012 9:09 pm

Re: Playing an mp3 stream with gstreamer

Thu Jul 26, 2012 10:19 pm

Got it working using ffmpeg but It is majorly distorted with a lot of crackles.

Anyone know why

The error I get in my terminal is

Code: Select all

ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occured0B f=0/0

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: Playing an mp3 stream with gstreamer

Fri Jul 27, 2012 12:04 am

I have the same problem too using qmmp (Winamp clone for X-windows) I'm getting ALSA buffer underruns using the PI sound chip.
I find this odd because a) qmmp is using about 14% CPU load to stream shoutcast audio and b) I have no such buffer underruns using my USB audio dongle.

I think Rasbian wheezy audio support is broken somehow.

Richard S.

microsnakey
Posts: 11
Joined: Wed Jun 20, 2012 9:09 pm

Re: Playing an mp3 stream with gstreamer

Fri Jul 27, 2012 12:33 am

redhawk wrote:I have the same problem too using qmmp (Winamp clone for X-windows) I'm getting ALSA buffer underruns using the PI sound chip.
I find this odd because a) qmmp is using about 14% CPU load to stream shoutcast audio and b) I have no such buffer underruns using my USB audio dongle.

I think Rasbian wheezy audio support is broken somehow.

Richard S.
Thanks it sometimes works fine but then when a buffer underrun hits it goes all crackly and pops. I am wondering if it raspbian's fault or maybe it actually needs buffering from the internet with ffplay, I am unsure if it does it by itself

khh
Posts: 49
Joined: Thu Jul 26, 2012 12:16 am

Re: Playing an mp3 stream with gstreamer

Fri Jul 27, 2012 9:18 am

microsnakey wrote:Thanks it sometimes works fine but then when a buffer underrun hits it goes all crackly and pops. I am wondering if it raspbian's fault or maybe it actually needs buffering from the internet with ffplay, I am unsure if it does it by itself
I think perhaps it's raspbian's fault, cause I get the same crackling when using ogg123 (from vorbis-tools) and playing from a file on the SD card. I also get an ALSA error message.

Code: Select all

ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front

jose1711_
Posts: 58
Joined: Sat Jul 21, 2012 10:03 am

Re: Playing an mp3 stream with gstreamer

Mon Aug 27, 2012 10:02 am

same here with tuxpaint. the sound is fine for a little while but as soon as i receive alsa underrun things get terribly wrong :-(

Return to “Python”