$ lame in.mp3 out.mp3; echo "EXIT STATUS: $?"
LAME 3.100 64bits (http://lame.sf.net)
Using polyphase lowpass filter, transition band: 16452 Hz - 17032 Hz
Encoding in.mp3 to out.mp3
Encoding as 48 kHz j-stereo MPEG-1 Layer III (12x) 128 kbps qval=3
hip: Aborting layer 1 decode, illegal bit allocation value
Frame | CPU time/estim | REAL time/estim | play/CPU | ETA
1/268116 ( 0%)| 0:00/ 1:27| 0:00/ 1:27| 73.846x| 1:27
-1:47:14-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
kbps MS % long %
128.0 100.0 100.0
Writing LAME Tag...done
ReplayGain: 0.0dB
EXIT STATUS: 0
Looks like lame can't decode input file:
hip: Aborting layer 1 decode, illegal bit allocation value
It is completely ok, since in.mp3 may be invalid (it was created with mp3wrap tool, which can produce invalid result in some circumstances). The problem is the lame's exit status: it is 0, what means "Everything is ok", while output file is not ok:
$ mediainfo in.mp3
General
Complete name : in.mp3
Format : MPEG Audio
File size : 52.2 MiB
Duration : 56 min 39 s
...
$ mediainfo out.mp3
General
Complete name : out.mp3
Format : MPEG Audio
File size : 299 KiB
Duration : 24 ms
...
Input file has 56 minutes 39 seconds of audio, while output file has only 24 milliseconds.
If lame can't produce valid output for any reason (including inability to read or decode the input file), it must exit with non-zero status.
I prepared a patch which solves this issue. See attachment.