Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not rewind in audio file. Terminating #16

Closed
danielmoore123 opened this Issue Oct 22, 2014 · 14 comments

Comments

Projects
None yet
6 participants
@danielmoore123
Copy link

danielmoore123 commented Oct 22, 2014

Hi, is there a way to get an icecast stream to pick itself up again after this error so I don't have to keep picking it up every few hours, it's a very disappointing bug. Thanks in advance

@RamonSmit

This comment has been minimized.

Copy link

RamonSmit commented Jan 6, 2015

Same problem here, looking for a solution.. Tried to change

return -1; to // return -1;

// fm_mpx.c
// Line 178

if(audio_len == 0) {
  if( sf_seek(inf, 0, SEEK_SET) < 0 ) {
      fprintf(stderr, "Could not rewind in audio file, terminating\n");
      return -1;
}

But that was not the solution..

@RamonSmit

This comment has been minimized.

Copy link

RamonSmit commented Jan 7, 2015

I found a kindaish solution..

It prebuffers the audio trough mpg123, then sox reads it as raw audio and outputs it as wav to PFR

mpg123 --buffer 2048 --no-icy-meta -q -s http://172.30.0.62:5010/ | sox -t raw -b 16 -e signed -c 2 -r 44100 - -t wav - equalizer 11800 0.7q 20 | sudo ./pi_fm_rds -rt 'Test FM 105.5' -pi 0528 -ps 'TEST FM' -freq '105.5' -ctl '/home/pi/rds_ctl' -audio -
@Hatagashira

This comment has been minimized.

Copy link

Hatagashira commented Feb 22, 2015

i fixed it and made a pull request.

@danielmoore123

This comment has been minimized.

Copy link
Author

danielmoore123 commented Aug 2, 2015

@RamonSmit could you please elaborate a little more on your kindaish solution, does this mean a full fix? Kindaish solution, how does it help in comparison to it breaking? and @Hatagashira How did you fix it? Where is your solution? Please share :-)

@Hatagashira

This comment has been minimized.

@RamonSmit

This comment has been minimized.

Copy link

RamonSmit commented Aug 6, 2015

@danielmoore123

My fix is more like a hotfix. It prébuffers the raw audio

I see that @Hatagashira got a better fix, I would stick to that 👍

@danielmoore123

This comment has been minimized.

Copy link
Author

danielmoore123 commented Aug 24, 2015

Hmmmm... Sorry guys, neither of those solutions are working.... is there a way to get it to start itself again automatically? If I press Up then enter it works again, I was just wondering if that could be automated or if the program can auto restart itself on failure?

@Hatagashira

This comment has been minimized.

Copy link

Hatagashira commented Sep 14, 2015

@danielmoore123 Since ChristopheJacquet has fixed a few bugs, updated some code and added pi2 support i'll attempt a new fix. Just... don't use an antenna unless you're in the middle of nowhere, the harmonics are dreadful.

@btweb

This comment has been minimized.

Copy link

btweb commented Nov 27, 2015

@danielmoore123 I too experience the dreaded "cannot rewind audio input" issue while streaming from sox.

To work around this I run the pipeline from shell script which just continually loops, e.g. in a file called xmit.sh (for example) put:

#!/bin/sh

FX='equalizer 100 50 -10 equalizer 5k 2k 0.5 compand 0.3,1 6:-70,-60,-20 -5 -65 0.2'
FREQ=107.9

while [ 1 ]
do
  sox -V3 -t ogg http://airtime.jda.local:8000/airtime_128 -t wav -  $FX | ./pi_fm_rds -freq $FREQ -pi FFFF -ps "HELLO" -rt "TEST" -audio -
done

Then if you chmod +x xmit.sh you can run ./xmit.sh (or sh xmit.sh) and when PiFmRds crashes out it goes back to the beginning of the loop.

It does take a while to come back again, but at least you'll find it still running in the morning :-)

@Hatagashira

This comment has been minimized.

Copy link

Hatagashira commented Nov 27, 2015

@btweb 's solution is the cleanest for now unless you edit the program to add an extra switch that tells it to never stop and just retry opening the file handle when the stream ends, feeding the modulator silence in the meantime so the RDS data continues to be generated.

My old patch is no longer relevant because @ChristopheJacquet fixed the carrier wave problem. I'll make the patch when i have time... and if i don't forget 😅

@btweb

This comment has been minimized.

Copy link

btweb commented Jan 5, 2016

Glad I posted that... I lost my SD card shortly after ;-)

@WangZhengmao

This comment has been minimized.

Copy link

WangZhengmao commented Jan 13, 2016

@RamonSmit your solution works well , but the code should be like this
mpg123 -y --stereo -r 44100 --buffer 4096 --no-icy-meta -q -s "$filename"| sox -v $vol -t raw -b 16 -e signed -c 2 -r 44100 - -t wav - equalizer 11800 0.7q 20 | sudo ./pi_fm_rds -rt 'Test FM 105.5' -pi 0528 -ps 'TEST FM' -freq '105.5' -ctl '/home/pi/rds_ctl' -audio -

--stereo -r 44100 should be added to play mono music , or it will play at twice speed.

@danielmoore123

This comment has been minimized.

Copy link
Author

danielmoore123 commented Feb 28, 2016

@btweb 's solution fixed it. As soon as it dies it comes back! One thing I will say, it failed at first but then I had to wipe my Pi and re-install the program and then this neat little trick worked, it didn't work though on piping from the Aux lead but via URL is fine.

@cusomancuso

This comment has been minimized.

Copy link

cusomancuso commented Mar 9, 2016

To work around this I run the pipeline from shell script which just continually loops
How do you do this? I get everything running awesome for 3 hours running this...
mpg123 -y --stereo -r 44100 -b 16384 -q -s -Z -i /home/pi/Music/* | sox -v 1.5 -t raw -b 16 -e signed -c 2 -r 44100 - -t wav - equalizer 11800 0.7q 20 | sudo /home/pi/PiFmRds/src/pi_fm_rds -rt 'Radio For Your Butthole' -pi 0528 -ps 'WFTW' -freq '107.9' -audio -
I'm a Linux noob, but catching on quickly. I wish we could just run without sox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.