Mechoption
Posts: 9
Joined: Thu Nov 12, 2015 1:46 am

mpc timeout error driving me crazy

Sat Sep 10, 2016 3:02 pm

I just did a completely fresh jessie install hoping that would fix my problem, but it did not :(
ran

Code: Select all

sudo apt-get install mpc mpd
Added some streaming urls (e.g. "

Code: Select all

mpc add http://8513.live.streamtheworld.com:80/CLASSICFM_SC
")

When I use

Code: Select all

mpc play 1
then

Code: Select all

mpc play 2
I get about two or three song changes before mpc hangs and I get "error: Timeout"

I found a post that seems to solve this http://unix.stackexchange.com/questions ... eout-error but it's written to complicated for me. Can anyone convert that post to a EL5 (Explain to me like I'm 5)? I'm the only person logging into the Pi and want it to play music on some speakers as a little standalone wifi radio. Works great now as long as I only change the channel once or twice...

pcmanbob
Posts: 2218
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: mpc timeout error driving me crazy

Sat Sep 10, 2016 8:28 pm

Hi.

I am not sure you are on the right track with that link you posted as they talk about configuring mdp to work with pulseaudio.

I think what you are actually seeing is the mdp server timing out after 60 sec which a saw on another project I advised on.
in that case we edited mdp.conf to change the time out to 21 days.

If you want to try that this is how you do it.

so we are going to edit the mpd.conf file to do this use the following

Code: Select all

sudo nano /etc/mpd.conf 
this should open the mpd.conf file
now using the down arrow key move right to the end of the file just keep your finger on the down arrow key till it gets to the end its a long way there are about 400 lines in the file
when you get to the end of the file move to the end of the line of #'s using right arrow key and hit Enter.
you should now be on a new line.
now you need to enter the following

Code: Select all

connection_timeout	"2000000"
now mpd.conf is a bit fussy about spacing so after you have typed the connection_timeout bit hit the tab key then type "2000000"
now press Ctrl and O it will as the file name to write to just hit Enter it should say wrote 419 lines or there about dont worry to much about the number.
now press Ctrl and X to exit nano.
you should now have set the connection time out to about 21 days.

let me know if it solves your problem.
Please only ask questions in the forum I will not answer questions sent to me directly via PM
Remember we want information.......................no information no help

Mechoption
Posts: 9
Joined: Thu Nov 12, 2015 1:46 am

Re: mpc timeout error driving me crazy

Sat Sep 10, 2016 9:28 pm

Gah, thanks for the detailed step by step response, but below is the result :( I got 419 lines, did a reboot, then entered commands below. Not sure if it matters, but I had already edited mpd.conf as per this post viewtopic.php?t=150505&p=990307 as I wasn't getting volume control.
pi@raspberrypi:~ $ mpc status
Franz Schubert - Benjamin Beilman - Sonate in A D 574 (1)
[playing] #1/2 0:44/0:00 (0%)
volume:100% repeat: off random: off single: off consume: off
pi@raspberrypi:~ $ mpc play 2
http://live.leanstream.co/CKQBFM
[playing] #2/2 0:00/0:00 (0%)
volume:100% repeat: off random: off single: off consume: off
pi@raspberrypi:~ $ mpc play 1
error: Timeout
pi@raspberrypi:~ $

pcmanbob
Posts: 2218
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: mpc timeout error driving me crazy

Sun Sep 11, 2016 11:55 am

Hi.

In that case it may not be mdp that is timing out.
or there is some other problem, having done a quick google search it seems there are may people finding they get this error and not just on the Pi and never seem to find a fix.

Edit.

Just tried running as you described on my pi it will not even play anything it just shows playing 0% and then stops ! so it seems mpd/mcp produce different results on different Pi's.

just been looking through the forum and found this post
viewtopic.php?t=6056
seems there have been problems with mdp/mpc since 2012 ! when changing station because ports not releasing which may be what you are see and hence the time out.
Please only ask questions in the forum I will not answer questions sent to me directly via PM
Remember we want information.......................no information no help

Mechoption
Posts: 9
Joined: Thu Nov 12, 2015 1:46 am

Re: mpc timeout error driving me crazy

Sun Sep 11, 2016 5:29 pm

Hmm, yeah, Google shows lots of people with this same issue but no clean fixes. I think I have three options:

1) Everything had been working fine on an older Raspian build, then my SD card corrupted somehow, so I installed the latest of everything and now this issue. So, I could try and scrounge up older Raspian builds and install that, but dread the hassles of getting everything working (particular python3 with the GPIO packages I'm using).

2) All I need is something that can play internet streams. I could like for an alternate to mpd but not sure my options. Just need to be able to control through python3 script.

3) Fiddle with my python script and see if I stop mpc and/or kill mpd before changing channels, maybe I can bypass this issue...

hal8000
Posts: 184
Joined: Fri Oct 04, 2013 5:22 pm

Re: mpc timeout error driving me crazy

Sun Sep 11, 2016 8:59 pm

The station that plays for a second then times out does not play at all on my
system, I get a failed to decode error (Rasbian Jessie Lite Mpd 0.19.1 )
Check the URL it may have a typo. Your other station works ok and plays,
I temporarily added your URL's to end of my playlist:

pi@anya:~ > mpc playlist
CINEMIX: Marco Beltrami - Repo Men - Repo Mambo
http://185.33.22.15:9010
http://radiorivendell.de
http://sc-costadelmar.1.fm:10156
http://stream4.slowradio.com
http://live.leanstream.co/CKQBFM
http://8513.live.streamtheworld.com:80/CLASSICFM_SC
pi@anya:~ > mpc play 7
http://8513.live.streamtheworld.com:80/CLASSICFM_SC
[playing] #7/7 0:00/0:00 (0%)
volume: 70% repeat: off random: off single: off consume: off
pi@anya:~ > mpc
volume: 70% repeat: off random: off single: off consume: off
ERROR: Failed to decode http://8513.live.streamtheworld.com:80/CLASSICFM_SC

The station Toronto station CKQB plays ok (in the UK) without problems, so I think
you have a mistake in that first station address, or its moved or changed its streaming
format. Check that URL again and post it again.
If you have timeouts with CKQB check your Internet speed with an online speed
checker.

Mechoption
Posts: 9
Joined: Thu Nov 12, 2015 1:46 am

Re: mpc timeout error driving me crazy

Sun Sep 11, 2016 9:21 pm

Weird, that station works fine for me (and on my windows PC). Output below:
pi@raspberrypi:~/radio $ mpc clear
volume:100% repeat: off random: off single: off consume: off
pi@raspberrypi:~/radio $ mpc playlist
pi@raspberrypi:~/radio $ mpc add http://8513.live.streamtheworld.com:80/CLASSICFM_SC
pi@raspberrypi:~/radio $ mpc play
http://8513.live.streamtheworld.com:80/CLASSICFM_SC
[playing] #1/1 0:00/0:00 (0%)
volume:100% repeat: off random: off single: off consume: off
pi@raspberrypi:~/radio $ mpc status
Wolfgang Amadeus Mozart - Pianosonate no.16 in C gr. KV 545 (1)
[playing] #1/1 0:50/0:00 (0%)
volume:100% repeat: off random: off single: off consume: off
pi@raspberrypi:~/radio $

Mechoption
Posts: 9
Joined: Thu Nov 12, 2015 1:46 am

Re: mpc timeout error driving me crazy

Sun Sep 11, 2016 9:30 pm

Fixed ! Well, with the ugliest kludge ever but this seems to work. Not ideal that I have to wait between channel changes but works in the short term.

Code: Select all

# This is the callback routine to handle channel events
def channel_event(event):
	if event == RotaryEncoder.CLOCKWISE:
		os.system("mpc stop")
		time.sleep(1)
		os.system("sudo service mpd stop")
		time.sleep(2)
		os.system("sudo service mpd start")
		os.system("mpc play 1")
		time.sleep(3)
	elif event == RotaryEncoder.ANTICLOCKWISE:
		os.system("mpc stop")
		time.sleep(1)
		os.system("sudo service mpd stop")
		time.sleep(2)
		os.system("sudo service mpd start")
		os.system("mpc play 2")
		time.sleep(3)
	elif event == RotaryEncoder.BUTTONDOWN:
		print(" button down")#, RotaryEncoder.BUTTONDOWN
	elif event == RotaryEncoder.BUTTONUP:
		print(" button up")#, RotaryEncoder.BUTTONUP
	return 1

hal8000
Posts: 184
Joined: Fri Oct 04, 2013 5:22 pm

Re: mpc timeout error driving me crazy

Mon Sep 12, 2016 5:00 pm

Glad its working for you now. What do you get if you open
the link in a browser? I get 403 forbidden, and just realised
that station is blocking my location. It plays fine when I use a proxy.

What tutorial did you follow to use your rotary encoder?

Mechoption
Posts: 9
Joined: Thu Nov 12, 2015 1:46 am

Re: mpc timeout error driving me crazy

Mon Sep 12, 2016 10:09 pm

Glad its working for you now. What do you get if you open
the link in a browser? I get 403 forbidden, and just realised
that station is blocking my location. It plays fine when I use a proxy
I put in Chrome on Win 10 in Canada and it just starts playing.
What tutorial did you follow to use your rotary encoder?
No tutorial, but use the class files from this fellow https://github.com/bobrathbone/piradio
and then reverse engineered the bits I needed.

csrlima
Posts: 1
Joined: Thu Sep 29, 2016 5:10 pm

Re: mpc timeout error driving me crazy

Thu Sep 29, 2016 5:13 pm

I fixed timeout error on raspbian !!!. I edit my /etc/mpd.conf

Only uncomment the lines and change mixer_type by "software"

audio_output {
type "alsa"
name "My ALSA Device"
device "hw:0,0" # optional
mixer_type "software" # optional
mixer_device "default" # optional
mixer_control "PCM" # optional
mixer_index "0" # optional
}

tyranith
Posts: 1
Joined: Thu Nov 24, 2016 9:09 pm

Re: mpc timeout error driving me crazy

Thu Nov 24, 2016 9:13 pm

I very thank you friend. This problem made me mad really. and your solution is absolutely right. I've solved my problem...

Return to “Troubleshooting”

Who is online

Users browsing this forum: No registered users and 25 guests