PDA

View Full Version : [kubuntu] Problems with ffmpeg



akwatve
May 8th, 2008, 12:18 AM
Hello,

I tried to use ffmpeg to convert (and resample) audio files. But I am facing few problems

1) When I explicitly specify audio codec as mp3, ffmpeg gives codec error

(Wed May 07 19:17:21)/data1> ffmpeg -ab 128k -acodec mp3 -i foo.wma foo.mp3
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-pp --enable-swscaler --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libogg --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 1d.49.3.0
libavcodec version: 1d.51.38.0
libavformat version: 1d.51.10.0
built on Mar 12 2008 15:36:03, gcc: 4.2.3 (Ubuntu 4.2.3-2ubuntu4)
Input #0, asf, from 'foo.wma':
Duration: 00:04:34.5, start: 2.600000, bitrate: 96 kb/s
Stream #0.0: Audio: wmav2, 44100 Hz, stereo, 96 kb/s
Output #0, mp2, to 'foo.mp3':
Stream #0.0: Audio: 0x0000, 44100 Hz, stereo, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Unsupported codec for output stream #0.0



However, when I don't specify any codec, conversion completes successfully. I am not sure whats going on... I have mp3lame-dev packages installed.

2) When I convert a file to mp3, I cannot play that file on my cell phone. Is there any difference between format of the mp3 file generated by ffmpeg and format expected by phones ? I have Sony Ericsson w580i


I am using 64 bit kubuntu hardy.

Thanks,

mc4man
May 8th, 2008, 03:07 AM
I was doing something similar for my son but his wma's were lossless so i used mplayer to convert to .wav then lame to mp3. The advantage was i could specify the bitrate. It appears ffmpeg will only do mp3 at the default 64kbps. This worked ....ffmpeg -i foo.wma -ac 2 foo.mp3, any attempt to add -ab xxx failed. (even with -ab 64 )
You should check if the ar needs to be something other than 44100 Hz for your phone. If so maybe ffmpeg -i foo.wma -ac 2 -ar 22050 foo.mp3
edt : i don't have a cell but it appears it plays normal mp3's (44100)

otherwise maybe try wma->wav (with mplayer)->mp3 (with lame)
the 'normal' way for ffmpeg is
ffmpeg [[infile options][-i infile]]... {[outfile options] outfile}...
though it didn't seem to matter in this case

akwatve
May 8th, 2008, 02:35 PM
Thanks for the reply. I will definitely check the specifications of the phone.

Coming to your point of specifying bitrate... I think I can use any bitrate I want to .. Its the "acodec" option that behaves weirdly.

e.g. ffmpeg -i foo.wma foo.mp3 WORKS

ffmpeg -i foo.wma -ab 128k foo.mp3 WORKS

BUT

ffmpeg -i foo.wma -acodec mp3 afoo.mp3 DOES NOT WORK

I am wondering if anyone else has seen similar behavior.

philc
May 8th, 2008, 03:05 PM
Looking at your FFMpeg output, it doesn't seem like you have configured it with MP3 support using --enable-libmp3lame

Then try -acoder libmp3lame

mc4man
May 8th, 2008, 06:10 PM
I think I can use any bitrate I want to .. Its the "acodec" option that behaves weirdly. Your right, I was forgetting to add k after 128
Works fine without specifing acodec

doug@doug-desktop:~$ ffmpeg -i foo.wma -ab 128k foo.mp3
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-pp --enable-swscaler --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libogg --enable-libgsm --enable-x264 --enable-liba52 --enable-libmp3lame --enable-libfaac --enable-libfaad --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 1d.49.3.0
libavcodec version: 1d.51.38.0
libavformat version: 1d.51.10.0
built on May 5 2008 11:58:28, gcc: 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
Input #0, asf, from 'foo.wma':
Duration: 00:04:59.4, start: 1.579000, bitrate: 128 kb/s
Stream #0.0: Audio: wmav2, 44100 Hz, stereo, 128 kb/s
Output #0, mp2, to 'foo.mp3':
Stream #0.0: Audio: mp2, 44100 Hz, stereo, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
size= 4680kB time=299.5 bitrate= 128.0kbits/s
video:0kB audio:4680kB global headers:0kB muxing overhead 0.000000%

tested with an external mp3 player, works fine. i did compile with libmp3lame enabled

akwatve
May 25th, 2008, 04:13 AM
I am using standard ffmpeg package that comes with ubuntu/kubuntu. How can I enable libmp3lame without having to compile ffmpeg myself ?

Thanks

kostkon
May 25th, 2008, 05:42 AM
I am using standard ffmpeg package that comes with ubuntu/kubuntu. How can I enable libmp3lame without having to compile ffmpeg myself ?

Thanks
Just install the version of FFmpeg offered by the Medibuntu (http://medibuntu.org/) repository, which has the support for restricted formats enabled.

akwatve
May 25th, 2008, 07:57 AM
Thanks Philc, kostkon, your suggestions worked....
I was able to convert wma into mp3 with different bitrate. Also my cell phone seems to be happy with it.