[clug] problem with 'lame'?

Eyal Lebedinsky eyal at eyal.emu.id.au
Tue Sep 16 18:21:44 MDT 2014


I wonder if anyone can explain the problem I had. I now do not use this method (I do ffmpeg) but still
want to understand why it was failing.

I was transcoding podcasts (music programs) for many years with a simple script.
This was the way of converting everything to pcm upfront (mplayer) then encode as mp3 (lame).

This worked fine until some time ago (first short one was Aug a year ago) when it started truncating files.
This was consistent, with exactly the same truncation every time. Below is an example.

(1) Note the original length 2:05:04.0
(2) Then note how lame *starts* with a length of 1:41:21
(3) The result says 1:41:27.0
(4) Finally note that capturing the pcm shows it is not truncated.


===== test.sh
prog="my_program"
pipe="$HOME/tmp/xxx"
mknod "$pipe" p
mplayer -really-quiet -nolirc -nojoystick -vo null -vc null -ao pcm:fast:waveheader:file="$pipe" $prog.m4a &
lame "$pipe" $prog.mp3
rm "$pipe"
=====


===== (1) play the original
$ mplayer my_program.m4a
MPlayer SVN-r36171-4.8.1 (C) 2000-2013 MPlayer Team

Playing my_program.m4a.
libavformat version 54.63.104 (external)
libavformat file format detected.
[lavf] stream 0: audio (aac), -aid 0, -alang und
Clip info:
  major_brand: mp42
  minor_version: 0
  compatible_brands: M4A mp42isom
  creation_time: 2014-09-13 01:07:19
  encoder: Nero AAC codec / 1.5.4.0
Load subtitles in ./
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 54.92.100 (external)
AUDIO: 44100 Hz, 2 ch, floatle, 64.0 kbit/2.27% (ratio: 7999->352800)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [pulse] 44100Hz 2ch floatle (4 bytes per sample)
Video: no video
Starting playback...
A:   1.2 (01.2) of 7504.0 ( 2:05:04.0)  0.5% 			<<<<<<<<<<
=====

===== (2) transcode$ sh test.sh
$ sh test.sh
LAME 3.99.5 64bits (http://lame.sf.net)
Using polyphase lowpass filter, transition band: 16538 Hz - 17071 Hz
Encoding /home/eyal/tmp/xxx to my_program.mp3
Encoding as 44.1 kHz j-stereo MPEG-1 Layer III (11x) 128 kbps qval=3
     Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
    200/233018 ( 0%)|    0:00/    5:26|    0:00/    5:28|   18.659x|    5:28
-1:41:21-------------------------------------------------------	<<<<<<<<<<
   128.0       23.0  77.0        98.5   0.5   1.0^C
=====


===== (3) play the result
$ mplayer my_program.mp3
MPlayer SVN-r36171-4.8.1 (C) 2000-2013 MPlayer Team

Playing my_program.mp3.
libavformat version 54.63.104 (external)
Audio only file format detected.
Load subtitles in ./
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   0.4 (00.4) of 6087.0 ( 1:41:27.0)  0.3%			<<<<<<<<<<
=====

===== (4) check the pcm
$ mplayer -really-quiet -nolirc -nojoystick -vo null -vc null -ao pcm:fast:waveheader:file=my_program.pcm my_program.m4a
$ mplayer my_program.pcm
MPlayer SVN-r36171-4.8.1 (C) 2000-2013 MPlayer Team

Playing my_program.pcm.
libavformat version 54.63.104 (external)
Audio only file format detected.
Load subtitles in ./
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 44100 Hz, 2 ch, floatle, 2822.4 kbit/100.00% (ratio: 352800->352800)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
AO: [pulse] 44100Hz 2ch floatle (4 bytes per sample)
Video: no video
Starting playback...
A:   0.7 (00.6) of 7504.0 ( 2:05:04.0)  0.0%			<<<<<<<<<<
=====

-- 
Eyal Lebedinsky (eyal at eyal.emu.id.au)


More information about the linux mailing list