[FFmpeg-user] How to convert 48000/2/FLOATLE AC3 to 48000/2/S16LE MP3

Rene Herman rene.herman at gmail.com
Wed Oct 9 00:42:29 CEST 2013


On 09-10-13 00:05, Carl Eugen Hoyos wrote:

> Rene Herman <rene.herman <at> gmail.com> writes:
>
>> $ ffmpeg -i "$SRC" -c:v mpeg4 -vtag xvid -vf
>> crop=1280:550:0:$(((720-550)/2+2)),scale=640:-1
>> -b:v 900k -c:a libmp3lame -af aformat=s16 -b:a 128k
>> -map_metadata -1 "$DST"
>
> lame accepts s32, s16 and float as input.
> I suspect that for speed and quality reasons, it
> is best not to force a conversion.
> (This may be wrong, it assumes that lame internally
> does no slow conversion.)

Thanks for the answer -- but speed and quality are not an issue. I'm 
transcoding "nice BD source" to "pathetic sub-dvd destination" anyway. 
It's just that the target does not support mp3float: I really want it to 
be just bog-standard s16le.

> Concerning the decoding:
> There are two mp3 decoders in FFmpeg (and both can
> be used from MPlayer), one outputs floats and is
> faster on typical hardware (modern x86 and ppc),
> one is faster on some embedded hardware.
> Except for the speed, there should be no measurable
> difference between the two, if there is, it may be
> a bug.

Sorry, but if you in the above provided an answer it seems I'm missing 
it. The mplayer output that I showed was just for showing how the input 
and output are recognized by mplayer (which is not the target: I'm 
transcoding for someone else).

Really all that I want to know is how to get ffmpeg to transcode 48k 
fltp AC3 to s16le MP3. By now I've also tried

   "-af aresample=48000:osf=s16"

but the result is still the same: floatle, and not s16. Is it just a bug 
that the s16 conversion specifier seems to be ignored, whatever I try?

> Generally, if you want help on this mailing list,
> please post your command line together with the
> complete, uncut console output.

Note how it says "s16p" in its output. I'm not actually sure what the 
"p" signifies, but it is in fact still producing floatle MP3 audio, and 
not s16:

[rene at e600 ~/Videos]$ ffmpeg -i 00000.m2ts -c:v mpeg4 -vtag xvid -vf 
crop=1280:550:0:$(((720-550)/2+2)),scale=640:-1 -b:v 900k -pass 2 -c:a 
libmp3lame -af aformat=s16 -b:a 128k -map_metadata -1 00000.avi
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
   built on Aug 11 2013 14:58:31 with gcc 4.8.1 (GCC) 20130725 (prerelease)
   configuration: --prefix=/usr --disable-debug --disable-static 
--enable-avresample --enable-dxva2 --enable-fontconfig --enable-gpl 
--enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm 
--enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb 
--enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus 
--enable-libpulse --enable-librtmp --enable-libschroedinger 
--enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis 
--enable-libvpx --enable-libx264 --enable-libxvid --enable-pic 
--enable-postproc --enable-runtime-cpudetect --enable-shared 
--enable-swresample --enable-vdpau --enable-version3 --enable-x11grab
   libavutil      52. 38.100 / 52. 38.100
   libavcodec     55. 18.102 / 55. 18.102
   libavformat    55. 12.100 / 55. 12.100
   libavdevice    55.  3.100 / 55.  3.100
   libavfilter     3. 79.101 /  3. 79.101
   libavresample   1.  1.  0 /  1.  1.  0
   libswscale      2.  3.100 /  2.  3.100
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from '00000.m2ts':
   Duration: 01:30:14.57, start: 599.958311, bitrate: 6838 kb/s
   Program 1
     Stream #0:0[0x1011](und): Video: h264 (High) ([27][0][0][0] / 
0x001B), yuv420p, 1280x720, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
     Stream #0:1[0x1100](bul): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 
5.1(side), fltp, 640 kb/s
Output #0, avi, to '00000.avi':
   Metadata:
     ISFT            : Lavf55.12.100
     Stream #0:0: Video: mpeg4 (xvid / 0x64697678), yuv420p, 640x275, 
q=2-31, pass 2, 900 kb/s, 23.98 tbn, 23.98 tbc
     Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000 
Hz, stereo, s16p, 128 kb/s
Stream mapping:
   Stream #0:0 -> #0:0 (h264 -> mpeg4)
   Stream #0:1 -> #0:1 (ac3 -> libmp3lame)
Press [q] to stop, [?] for help
frame=  755 fps= 37 q=4.1 Lsize=    3239kB time=00:00:31.65 bitrate= 
838.2kbits/s
video:2686kB audio:494kB subtitle:0 global headers:0kB muxing overhead 
1.846697%

And only to show the result:

[rene at e600 ~/Videos]$ mplayer 00000.avi
MPlayer SVN-r36285-4.8.1 (C) 2000-2013 MPlayer Team
Cannot test OS support for SSE, disabling to be safe.
205 audio & 424 video codecs

Playing 00000.avi.
libavformat version 55.7.100 (internal)
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO:  [xvid]  640x275  24bpp  23.976 fps  696.9 kbps (85.1 kbyte/s)
Clip info:
  Software: Lavf55.12.100
Load subtitles in ./
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 55.12.100 (internal)
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
mpg123 init error: Error reading the stream. (code 18)
ADecoder init failed :(
ADecoder init failed :(
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, floatle, 128.0 kbit/4.17% (ratio: 16000->384000)
Selected audio codec: [ffmp3float] afm: ffmpeg (FFmpeg MPEG layer-3 audio)
==========================================================================
AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...


More information about the ffmpeg-user mailing list