环境:RedHat as 4 (gcc:3.4.6)
FFmpeg软件只是个解码编码软件,如果支持多种格式必须先安装好对应的库,下面就说说装库:
由于gcc版本低下载的Faac及Faad2版本不能是最新的。到网上下载faac-1.24.tar.gz及faad2-2.0.tar.gz
1. Faac
#wget ftp://ftp.uni-frankfurt.de/pub/Mirrors2/gentoo.org/distfiles/faac-1.24.tar.gz
# tar xvfz faac-1.24.tar.gz
# cd faac
#chmod 777 bootstrap
# ./bootstrap
# ./configure
# make
# make install
2. Faad2
IE下载:http://download.chinaunix.net/down.php?id=5363&ResourceID=2885&site=1
# tar xvfz faad2-2.0.tar.gz
# cd faad2
#chmod 777 bootstrap
# ./bootstrap
# ./configure
(make以前把faad2主目录下的Makefile修改下,找到有“rpm: Makefile”的一行,把它下面三行前面的所有空格都改成一个TAB符,否则,编译会报错)
# make
# make install
3. FFmpeg
#wget http://ffmpeg.org/releases/ffmpeg-0.5.tar.bz2
# bzip2 -d ffmpeg-0.5.tar.bz2
# tar -xf ffmpeg-0.5.tar
# cd ffmpeg-0.5
# ./configure --enable-shared "
--enable-gpl "
-enable-libfaac "
--enable-libfaad "
--enable-libfaadbin
# make
(可能出现的错误:
/usr/include/linux/videodev.h:55: error: syntax error before "ulong"
/usr/include/linux/videodev.h:71: error: syntax error before '}' token
libavdevice/v4l.c: In function `grab_read_header':
libavdevice/v4l.c:77: error: storage size of 'tuner' isn't known
libavdevice/v4l.c:141: error: invalid application of `sizeof' to incomplete type `video_tuner'
libavdevice/v4l.c:148: error: invalid application of `sizeof' to incomplete type `video_tuner'
libavdevice/v4l.c:77: warning: unused variable `tuner'
make: *** [libavdevice/v4l.o] 错误 1
vi /usr/include/linux/videodev.h
查找rangelow, rangehigh; /* Tuner range */这一行
把 ulong rangelow, rangehigh; /* Tuner range */
改为:
unsigned long rangelow, rangehigh; /* Tuner range */
这可能是源代码videodev.h不是针对次版本Linux写的,标准C没有ulong类型,所以要改成unsigned long
)
# make install
4. 运行 ffmpeg
成功看到:configuration: --enable-gpl --enable-shared --enable-libfaac --enable-libfaad --enable-libfaadbin
说明faac及faad2 已加入到了ffmpeg中
可能出的错误:
ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory
解决办法:
vi /etc/ld.so.conf
加入:/usr/local/lib
执行ldconfig
5. 音源转换命令:
采样率 -ar 44100
声道 -ac 1/2
码率/比特率 -ab 32k/218k
编码率:-acodec (AAc格式:libfaac)
ffmpeg –i 2.mp3 -ac 2 -ab 114k -acodec libfaac 2.aac(90比特率)
ffmpeg -i 2.mp3 -ac 2 -ab 78k -acodec libfaac 2.aac(64比特率)
Other Error - bitrate parameter is set too low :
This is probably with relation to the audio bitrate. -ab 56 sets the audio bitrate to 56 bits per second. Try either -ab 56k or -ab 56000 for 56 kbps.