ffmpeg安装
1.windows 安装
- 官网下载地址 到官网下载对应 windows 安装包下载
- 解压该安装包到指定目录
- 配置环境变量为 bin 路径 (其下包含 ffmpeg.exe)
ffmpeg -version
验证安装
2.CentOS 安装
CentOS 安装 ffmpeg 需要前置安装 lame 和 yasm 。
lame--libmp3lame的安装包,支持MP3编码;yasm--NASM的重写,用于编译ffmpeg。
-
编译安装 (ffmpeg 需最后安装)
安装 lame
tar -zxf lame-3.100.tar.gz cd lame-3.100 ./configure make make install
安装 yasm
tar -zxf yasm-1.3.0.tar.gz cd yasm-1.3.0 sed -i 's#) ytasm.*#)#' Makefile.in ./configure make make install
安装 ffmpeg
tar -jxf ffmpeg-3.4.tar.bz2 cd ffmpeg-3.4 ./configure --enable-shared --enable-libmp3lame make make install
-
配置调整 执行:
ffmpeg -version
保错:ffmpeg: error while loading shared libraries: libavdevice.so.57: cannot open shared object file: No such file or directory
ffmpeg 命令使用
剪切音频: 将 input.mp3 剪切前 5 分钟输出为 output.mp3
ffmpeg -y -i input.mp3 -ss 00:00:00 -t 00:05:00 output.mp3