Menu

#456 LAME stops running after some time

Usability
open
nobody
None
6
2020-07-07
2017-03-07
No

When running lame with the input being a pipe from arecord, and piping the output to ezstream (http://icecast.org/ezstream/) after a few hours the LAME process dissapears (dies). For example,
arecord -f dat -c 1 | /usr/bin/lame -r -s 48 --resample 22.05 -m m -b 16 --cbr --lowpass 4 - - | /usr/bin/ezstream -c /etc/ezstream_bcfy.xml > var/log/bcfy.log 2>&1 & Runs fine, until some point where it stops working, (presumably) because Lame has stopped running, while the other 2 commands continue, with ezstream running with high CPU (links below suggest because waiting for input from LAME).
A temporary fix is to frequently check whether LAME is running, and if it quit restart the above commands, but that's not a permanent solution.
This person had the same issue, and reccomended the fix--http://ohnosec.org/pipermail/app_rpt-users/2016-May/014103.html as well as here http://wiki.radioreference.com/index.php/Raspberry_Pi_RTL-SDR_Broadcastify#Verify_System_is_running_and_connected

Running LAME 32bits version 3.99.5, on Ubuntu 16.04 Linux kernel 4.4.0-65-generic

Discussion

  • Tzvi Merczynski-Hait

    Lame seems to quit about every 6 hours and 10 minutes.

     
  • Robert Hegemann

    Robert Hegemann - 2017-08-15

    I have wriiten a little PCM generator, which produces 24 hours of PCM data. The PCM data is piped into lame to encode it and piped into another lame to decode it:

    >pcm_generator | output\ReleaseSSE2\lame -r -s 48 --resample 22.05 -m m -b 16 --cbr --lowpass 4 - - | output\ReleaseSSE2\lame.exe --decode --mp3input - nul
    input:  <stdin>  (22.05 kHz, 1 channel, MPEG-2 Layer III)
    output: nul  (16 bit, Microsoft WAVE)
    skipping initial 529 samples (encoder+decoder delay)
    Frame#3307422/3307422  16 kbps         Assuming raw pcm input file
    LAME 3.99.5 32bits (http://lame.sf.net)
    CPU features: SSE (ASM used), SSE2 (ASM used)
    Resampling:  input 48 kHz  output 22.05 kHz
    Using polyphase lowpass filter, transition band:  4001 Hz -  4268 Hz
    Encoding <stdin> to <stdout>
    Encoding as 22.05 kHz single-ch MPEG-2 Layer III (22x)  16 kbps qval=3
    Frame#3307501/3307501  16 kbps
    

    As you can see, LAME does encode the whole 24 hours.

    Maybe you can try to leave out the streaming step out of your command chain, and let lame write the output data into /dev/null. Then let it run and check if it makes it past the 6 hours and 10 minutes mark.

     
  • Ben Wallens

    Ben Wallens - 2020-07-07

    I had the same problem using Ubutnu 20.4 server.
    LAME would die after 6 hours.
    I was able to work around this using ffmpeg instead of lame.
    My stream has been up for several hours now.

    I did install LAME before ffmpeg, so I had the libs.
    (Installed both with apt using the Ubuntu repos)
    Here's the command I used. you'll need to use arecord -L to determine your sound card values.

    ffmpeg -f alsa -i default:CARD=I82801AAICH -codec:a libmp3lame -b:a 128k -f mp3 pipe:1 | ezstream -c /etc/ezstream/ezstream_stdin_vorbis.xml
    
     

Log in to post a comment.

MongoDB Logo MongoDB