tar -zxvf lame-3.99.5.tar.gz cd lame-3.99.5 ./configure --enable-shared make make install
◆ 安装 FFmpeg
tar -jxvf ffmpeg-3.1.3.tar.bz2 cd ffmpeg-3.1.3 ./configure --enable-shared --disable-yasm --enable-libmp3lame make make install
◆ 修改服务器配置
vim /etc/ld.so.conf 在文件末尾添加/usr/local/lib ldconfig -v
◆ 音频转换
ffmpeg -i test.amr out.mp3
转换过程输出内容:
ffmpeg version 3.1.3 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.4.6 (GCC) 20110731 (Red Hat 4.4.6-3) configuration: --enable-shared --disable-yasm --enable-libmp3lame libavutil 55. 28.100 / 55. 28.100 libavcodec 57. 48.101 / 57. 48.101 libavformat 57. 41.100 / 57. 41.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 47.100 / 6. 47.100 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 1.100 / 2. 1.100 [amr @ 0x1575360] Estimating duration from bitrate, this may be inaccurate Input #0, amr, from 'test.amr': Duration: 00:00:01.56, bitrate: 5 kb/s Stream #0:0: Audio: amr_nb (samr / 0x726D6173), 8000 Hz, mono, flt [mp3 @ 0x1587140] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Output #0, mp3, to 'out.mp3': Metadata: TSSE : Lavf57.41.100 Stream #0:0: Audio: mp3 (libmp3lame), 8000 Hz, mono, fltp Metadata: encoder : Lavc57.48.101 libmp3lame Stream mapping: Stream #0:0 -> #0:0 (amr_nb (amrnb) -> mp3 (libmp3lame)) Press [q] to stop, [?] for help test.amr: Input/output error size= 2kB time=00:00:01.58 bitrate= 10.0kbits/s speed= 193x video:0kB audio:2kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 15.104167%
异常处理
◆ yasm/nasm not found or too old. Use –disable-yasm for a crippled build.
执行./configure时出现该错误,则使用
◆ error while loading shared libraries: libavdevice.so.52
在执行音频转换命令时报错,原因是缺少了上文中提到的修改服务器配置过程。
◆ Encoder (codec mp3) not found for output stream #0:0
在执行音频转换命令时报错,原因是没有安装Lame。
◆ yasm/nasm not found or too old. Use –disable-yasm for a crippled build.
执行./configure时出现该错误,则使用
--disable-yasm
◆ error while loading shared libraries: libavdevice.so.52
在执行音频转换命令时报错,原因是缺少了上文中提到的修改服务器配置过程。
◆ Encoder (codec mp3) not found for output stream #0:0
在执行音频转换命令时报错,原因是没有安装Lame。
您可以选择一种方式赞助本站