aac => mp3 using ffmpeg (newbie question)

  • Thread starter Thread starter petru.marginean
  • Start date Start date
P

petru.marginean

Hi,

I'm trying to convert a aac file (retrieved from a online radio
station, using fPls) into a mp3 file (to listen to it on my MP3
player).
I've compiled 'mplayer' and 'ffmpeg' (on Windows, using cygwin).
I can do the following basic operations:
1. Listen to the aac file using 'mplayer' (I assume then the aac
decoder is working, right?)
2. Convert a mp3 to another mp3 file using 'ffmpeg' (I assume then
the mp3 coder is working, right?)
3. Convert a mp3 to a aac file
However when trying to:
4. Convert a aac to mp3 file, I get this error:
"Unsupported codec (id=86018) for input stream #0.0"

I pasted below samples for every the above operations. I guess the
answer is in the output these utilities shows, but I cannot decode it
myself.
Any idea what's wrong and what diagnotics/testing I can do more?

Many thanks,
Petru

1. Listen to a aac file is working fine:
-----------------------------------------------------
$> mplayer /tmp/radio/input.aac
MPlayer dev-SVN-r19147-3.4.4 (C) 2000-2006 MPlayer Team
CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ (Family: 15, Model:
35, Stepping: 2)
CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2

Playing /tmp/radio/input.aac.
libavformat file format detected.
==========================================================================
Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
AUDIO: 44100 Hz, 2 ch, s16le, 35.5 kbit/2.51% (ratio: 4435->176400)
Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio)
decoder)
==========================================================================
AO: [win32] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A: 2.7 (02.6) of 1233.4 (20:33.4) 4.1%

2. Converting a mp3 to another mp3 file is also working (128Kb => 64Kb)
---------------------------------------------------------------------------------------------------------
$> ffmpeg -i /tmp/radio/input.mp3 -acodec mp3 -ac 2 -ab 64
/tmp/radio/test.mp3
FFmpeg version SVN-r5804, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-mp3lame --enable-faac
libavutil version: 49.0.0
libavcodec version: 51.10.0
libavformat version: 50.5.0
built on Jul 23 2006 02:11:46, gcc: 3.4.4 (cygming special) (gdc
0.12, using dmd 0.125)
Input #0, mp3, from '/tmp/radio/input.mp3':
Duration: 00:02:40.7, start: 0.000000, bitrate: 128 kb/s
Stream #0.0: Audio: mp3, 44100 Hz, stereo, 128 kb/s
File '/tmp/radio/test.mp3' already exists. Overwrite ? [y/N] y
Output #0, mp3, to '/tmp/radio/test.mp3':
Stream #0.0: Audio: mp3, 44100 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
size= 1256kB time=160.8 bitrate= 64.0kbits/s
video:0kB audio:1256kB global headers:0kB muxing overhead 0.000000%

3. Convert a mp3 to a aac file is fine
----------------------------------------------
$> ffmpeg -i /tmp/radio/input.mp3 -acodec aac /tmp/radio/output.aac
FFmpeg version SVN-r5804, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-mp3lame --enable-faac
libavutil version: 49.0.0
libavcodec version: 51.10.0
libavformat version: 50.5.0
built on Jul 23 2006 02:11:46, gcc: 3.4.4 (cygming special) (gdc
0.12, using dmd 0.125)
Input #0, mp3, from '/tmp/radio/input.mp3':
Duration: 00:02:40.7, start: 0.000000, bitrate: 128 kb/s
Stream #0.0: Audio: mp3, 44100 Hz, stereo, 128 kb/s
Output #0, adts, to '/tmp/radio/output.aac':
Stream #0.0: Audio: aac, 44100 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
size= 1255kB time=160.6 bitrate= 64.0kbits/s
video:0kB audio:1255kB global headers:0kB muxing overhead 0.000000%

4. Converting the aac input file to a mp3 file fails!!
------------------------------------------------------------------------
$> ffmpeg -i /tmp/radio/input.aac -acodec mp3 -ac 2 -ab 128
/tmp/radio/test.mp3
FFmpeg version SVN-r5804, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-mp3lame --enable-faac
libavutil version: 49.0.0
libavcodec version: 51.10.0
libavformat version: 50.5.0
built on Jul 23 2006 02:11:46, gcc: 3.4.4 (cygming special) (gdc
0.12, using dmd 0.125)
Input #0, aac, from '/tmp/radio/input.aac':
Duration: 00:20:33.4, start: 0.000000, bitrate: 35 kb/s
Stream #0.0: Audio: 0x0000, 22050 Hz, stereo, 35 kb/s
File '/tmp/radio/test.mp3' already exists. Overwrite ? [y/N] y
Output #0, mp3, to '/tmp/radio/test.mp3':
Stream #0.0: Audio: mp3, 22050 Hz, stereo, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Unsupported codec (id=86018) for input stream #0.0
 
I'm trying to convert a aac file (retrieved from a online radio
station, using fPls) into a mp3 file (to listen to it on my MP3
player).
I've compiled 'mplayer' and 'ffmpeg' (on Windows, using cygwin)...

Mplayer in MS-Windows will use the Windows codecs already
installed in your system. ffmpeg will not. I see that libfaad2
is not listed in your sample output. The following links say
that you must recompile ffmpeg with --enable-faad to include
libfaad2 for aac decoding, and explain how to do that:

<http://lists.mplayerhq.hu/pipermail/ffmpeg-user/2006-April/002746.html>
<http://forum.rivavx.com/viewtopic.php?t=96&view=next&sid=ece5c4b38ae70af86f37da198151ba2b>

I prefer to use "faad 2" for command-line AAC decoding (faac is
an aac encoder, faad is the matching decoder). You can download
a precompiled Win32 binary of faad 2 at
http://rarewares.org/aac.html
For source code or more information about faac and faad, see
http://www.audiocoding.com
http://sourceforge.net/projects/faac
 
Thanks for help!
I run in other problems when tryin to compile faad2 library:

1. I've dowloaded faad2 from here:

http://prdownloads.sourceforge.net/faac/faad2-2.0.tar.gz?download

2. Expanded and configured it (got a warning here!!!):
$> tar xvfz faad2-2.0.tar.gz
//..
$> cd faad2
$> ./bootstrap
configure.in:38: warning: underquoted definition of
MY_CHECK_TYPEDEF_FROM_INCLUDE
run info '(automake)Extending aclocal'
or see
http://sources.redhat.com/automake/automake.html#Extending-aclocal
configure.in: installing `./install-sh'
configure.in: installing `./missing'
common/mp4ff/Makefile.am: installing `./depcomp'
plugins/xmms/src/Makefile.am: installing `./compile'
Makefile.am: installing `./INSTALL'
Ready to run ./configure
$>./configure
//...

3. Build the lib (got the first error):
$> make
Makefile:624: *** missing separator. Stop.

The line 624 is
//...
632> rpm: Makefile
624> make dist
625> $(RPMBUILD) -ta $(PACKAGE)-$(VERSION).tar.gz
626> rm $(PACKAGE)-$(VERSION).tar.gz
4. I manually removed the whole 'rpm' target above, and tried to 'make'
again, but got an error about "conflicting types for 'lrintf'...

$> make
make all-recursive
make[1]: Entering directory `/usr/src/faad2'
Making all in libfaad
make[2]: Entering directory `/usr/src/faad2/libfaad'
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I.
-I. -I.. -g -O2 -MT bits.lo -MD -MP -MF ".deps
/bits.Tpo" -c -o bits.lo bits.c; \
then mv -f ".deps/bits.Tpo" ".deps/bits.Plo"; else rm -f
".deps/bits.Tpo"; exit 1; fi
mkdir .libs
gcc -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -MT bits.lo -MD -MP -MF
..deps/bits.Tpo -c bits.c -DDLL_EXPORT -DPIC -o .libs/b
its.o
In file included from common.h:347,
from bits.c:28:
/usr/include/math.h:278: error: conflicting types for 'lrintf'
common.h:314: error: previous definition of 'lrintf' was here
make[2]: *** [bits.lo] Error 1
make[2]: Leaving directory `/usr/src/faad2/libfaad'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/faad2'
make: *** [all] Error 2


Now I'm stuck again.
Any idea?

Regards,
Petru
 
Hey,

"Switch" is great: I installed it, and it's working just fine. Thanks
for sharing this info with me.

However I need to do the convertion from the command-line. I plan to
get the online radio station file, convert it and transfer it to my MP3
player using a script (that run overnight).
With Switch (GUI) I will have to click-click-click forever.
For that reason I chose "ffmpeg". But now I'm stuck compiling the faad2
on Cygwin.
Any idea?

Best regards,
Petru
 
Rich_on 24-Jul-2006 said:
"Switch" is great: I installed it, and it's working just fine. Thanks
for sharing this info with me.

However I need to do the convertion from the command-line. I plan to
get the online radio station file, convert it and transfer it to my MP3
player using a script (that run overnight).
With Switch (GUI) I will have to click-click-click forever.
For that reason I chose "ffmpeg". But now I'm stuck compiling the faad2
on Cygwin.
Any idea?
<snipped a bit>

I only once needed to convert a .aac file which was when I found switch.

You say that you are compiling faad - why not use the already compiled faad
from rarewares.org that Mark Blain pointed out.
You would have to go .aac to .wav then use the output and convert to .mp3
I have just been looking at Super(c) from eRightsoft which uses ffmpeg and
will convert much multimedia all ways, but not .aac to .mp3. Perhaps it is
not posible?
 
Probably I don't know how these things work: I was thinking by
compiling faad2 I would end up with some header files (*.h) and
libraries (*.a) that ffmpeg would use (and it seems it looks for when
configure with the --enable-faad flag)
Please correct me if I'm wrong.
From the website http://rarewares.org/aac.html I can download the
faad.exe file or the libfaad.dll file. I'm not sure how to use them.

What I want is to be able to configure ffmpeg to use faad:
$> ./configure --enable-faad ...

Best regards,
Petru
 
I dowloaded the percompiled faad utility and tried to get the *.wav
from the *.aac file. I get this error:

$> faad -o test.wav KissMusic.aac
*********** Ahead Software MPEG-4 AAC Decoder V2.1 beta
******************
Build: Jul 9 2004
Copyright 2002-2004: Ahead Software AG
http://www.audiocoding.com
Floating point version
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License.

**************************************************************************
KissMusic.aac file info:
RAW
Error: Invalid number of channels

Any idea what's wrong?

Regards,
Petru
 
Rich_on 25-Jul-2006, (e-mail address removed) wrote:


I want to also specify that the input file is playable by both mplayer
and WinAmp.
You can see here the 'Properties' screen from WinAmp for this specific
input file:

http://www.petrum.net/tmp/WinAmp-screen.JPG

I dont think that I can add much more as I do not normally need to convert
..aac files
however I have tried a few simple tests to see what works and does not.

1. faad
Not having any .aac files I had to make one so I could decode it.
Using belight - a front end for besweet, and the aac conversion option,
there is the first problem - what codec?
There is a faac codec which will make a .aac file which faad will decode.
There is a nero codec which make a .mp4 file which produces the error you
get - RAW - error: invalid number of channels.
I do not know how to fix this problem.

2. Super(c) converter
I mentioned this before because I thought it might convert a .aac file but
didn't.
That was on my new-ish computer which I use for video and graphics.
I installed Super on my old internet box (this one) and for some reason it
will convert the .mp4 file ( the RAW file) but still does not convert the
..aac file.
The point of this is: Super is only a front end for ffmpeg and other things.
By stopping Super half way through a .mp4 to .mp3 conversion I was able to
"rescue" the avisynth script it used.

this is the content of sample.avs
Clip=DirectShowSource("E:\sample.mp4", fps=25, convertfps=true)
ConvertToYV12(Clip)
Subtitle("Me ; )", font="verdana", size=14, text_color=$1afffa,
halo_color=$1f4afa, align=3)

As you see it uses directx in the conversion.
You can use this script as input to ffmpeg bypassing the Superfront end.

ffmpeg -i sample.avs -acodec mp3 test.mp3

Suggestion: Get Super(c) from eRightSoft and see if it will convert your
..aac file, try renaming to .mp4 as .aac is not a valid imput.
If it does, taskkill Super and retrieve the avisynth script from your temp
folder.

Suggestion: Try one of the video forums, possibly doom9.org, they know all
there is to know about ffmpeg. Have a look at avisynth and how it interacts
with ffmpeg.

Suggestion: stop top posting.

Best of luck
 
rich said:
Suggestion: Try one of the video forums, possibly doom9.org, they know all
there is to know about ffmpeg. Have a look at avisynth and how it interacts
with ffmpeg.

Suggestion: stop top posting.

Best of luck

Thanks for help and sorry for top-posting.
I finally was able to compile both 'faad2' and configure 'ffmpeg' to
use it. I manually removed some WIN32 directives from the source code.
I also got help from here:
http://groups.google.com/group/gnu....bac00?lnk=st&q=&rnum=4&hl=en#71f336b6fb0bac00

I commented some lines in file /usr/src/faac/include/faac.h:
/* #ifdef WIN32 */
/* # ifndef FAACAPI */
/* # define FAACAPI __stdcall */
/* # endif */
/* #else */
/* # ifndef FAACAPI */
# define FAACAPI
/* # endif */
/* #endif */

and also removed in the faad2/libfaad/common.h
/*
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(HAVE_LRINTF)
#define HAS_LRINTF
static INLINE int lrintf(float f)
{
int i;
__asm
{
fld f
fistp i
}
return i;
}
#elif (defined(__i386__) && defined(__GNUC__)) &&
!defined(HAVE_LRINTF)
#define HAS_LRINTF
// from http://www.stereopsis.com/FPU.html
static INLINE int lrintf(float f)
{
int i;
__asm__ __volatile__ (
"flds %1 \n\t"
"fistpl %0 \n\t"
: "=m" (i)
: "m" (f));
return i;
}
#endif
*/

The 'ffmpeg' now converts with no problem from aac tp mp3.

I ran into another problem but it seems somebody already suggested a
fix:
http://groups.google.com/group/alt....1095d?lnk=st&q=&rnum=2&hl=en#b9731f90b571095d
I'll try it ASAP (as I get home) ;-)

Regards,
Petru
P.S. News groups are great! I couldn't do it without them!
 
(e-mail address removed) wrote in
Thanks for help and sorry for top-posting.
I finally was able to compile both 'faad2' and configure 'ffmpeg' to
use it. I manually removed some WIN32 directives from the source code.
I also got help from here:
http://groups.google.com/group/gnu.gcc.help/browse_frm/thread/ac3a49573
f48a5ff/71f336b6fb0bac00?lnk=st&q=&rnum=4&hl=en#71f336b6fb0bac00

Sorry I was out of touch. I couldn't have helped any further with your
compiling issue anyway. I'm glad you were able to solve the problem.
 
Mark said:
(e-mail address removed) wrote in


Sorry I was out of touch. I couldn't have helped any further with your
compiling issue anyway. I'm glad you were able to solve the problem.

Hi,

After conversion (using ffmpeg, see below) from aac to mp3, the output
file is too big, and, when listening to it, the music is way too
slow. I've even compiled everything (faac, faad2, lame, ffmpeg) on
Linux, thinking the Cygwin build is bogus, but I've got the same
sloooow mp3 output file.
I've tried to change the output (to 44100Hz) like suggested here:
http://groups.google.com/group/alt....1095d?lnk=st&q=&rnum=2&hl=en#b9731f90b571095d
but with no success.
I've also posted on the doom9.org, but nobody answered:
http://forum.doom9.org/showthread.php?t=114261

Anybody any suggestion, idea?

Thanks,
Petru

$> ffmpeg -i /tmp/radio/input-from-radio.aac -acodec mp3
/tmp/radio/output.mp3
FFmpeg version SVN-r5804, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-mp3lame --enable-faac --enable-faad
--enable-gpl
libavutil version: 49.0.0
libavcodec version: 51.10.0
libavformat version: 50.5.0
built on Jul 25 2006 07:42:27, gcc: 3.4.4 (cygming special) (gdc
0.12, using dmd 0.125)
Input #0, aac, from '/tmp/radio/input-from-radio.aac':
Duration: 00:20:33.4, start: 0.000000, bitrate: 35 kb/s
Stream #0.0: Audio: aac, 22050 Hz, stereo, 35 kb/s
File '/tmp/radio/output.mp3' already exists. Overwrite ? [y/N] y
Output #0, mp3, to '/tmp/radio/output.mp3':
Stream #0.0: Audio: mp3, 22050 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
size= 21371kB time=2735.5 bitrate= 64.0kbits/s
video:0kB audio:21371kB global headers:0kB muxing overhead 0.000000%

$> ls -l /tmp/radio/input-from-radio.aac /tmp/radio/output.mp3
-rwxrwxrwx 1 HP_Administrator None 5471126 Jul 20 07:09
/tmp/radio/input-from-radio.aac
-rw-rw-rw- 1 HP_Administrator None 21883715 Jul 25 08:01
/tmp/radio/output.mp3
 
Back
Top