[clug] problem with 'lame'?

Eyal Lebedinsky eyal at eyal.emu.id.au
Tue Sep 16 23:52:10 MDT 2014


On 17/09/14 13:41, Bob Edwards wrote:
> On 17/09/14 10:21, Eyal Lebedinsky wrote:
>> 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.
>
> Hi Eyal,
>
> I haven't done this sort of stuff for some years, but I notice your
> script is invoking mplayer with "-really-quiet". Maybe try running
> mplayer without "-really-quiet" and see if it is trying to tell you
> something significant about the file it is generating?

Have tested this. Yes, there are some messages, like:

===== mplayer log
Starting playback...
A:6087.2 ( 1:41:27.1) of 7504.0 ( 2:05:04.0)  0.4%


MPlayer interrupted by signal 13 in module: play_audio
A:6087.3 ( 1:41:27.3) of 7504.0 ( 2:05:04.0)  0.4%
Could not seek to start, WAV size headers not updated!

Exiting... (Quit)
=====

signal 13 = broken pipe.

My analysis: initial header contains a rough estimate (1:41:27.3) and lame closes
its input after reading that much, leading to mplayer getting signalled.

I then decided to run to a pipe but without lame:
	mplayer -nolirc -nojoystick -vo null -vc null -ao pcm:fast:waveheader:file="$pipe" "$prog.m4a" &>mplayer.log &
	cat "$pipe" >"$prog.pcm"
	lame "$prog.pcm" "$prog.mp3"
And then again, directly:
	mplayer -nolirc -nojoystick -vo null -vc null -ao pcm:fast:waveheader:file="$prog-direct.pcm" "$prog.m4a"

To see what I get. The first run says
	Could not seek to start, WAV size headers not updated!
but not the second (understandably). Both produce the same file size, yet players
(mplayer and lame) report each as having a different length.

So I do understand what is happening here, but what worries me is that this was not an issue
until a year ago, so why did the problem start? What changed?

Just to be sure, I will recover the script from my long term offsite to see if I did change
something.

Thanks
	Eyal

> Cheers,
>
> Bob Edwards.
>
>>
>> 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