更新ffmpeg

今天对公司线上的几台机器做了下ffmpeg的更新,没有什么技术含量,还是简单记录下,做个流水账~哈哈

软件包获取方式

官方网站:https://ffmpeg.org/download.html
github:https://github.com/FFmpeg/FFmpeg/releases

更新前版本确认

升级前确认版本信息 ==> 2.4

[root@thatsit FFmpeg-n3.1.2]# ffmpeg -version|grep version
ffmpeg version 2.4 Copyright (c) 2000-2014 the FFmpeg developers
[root@thatsit FFmpeg-n3.1.2]#

更新操作

下面以更新到3.1.2为例

1,安装新版本ffmpeg

wget https://github.com/FFmpeg/FFmpeg/archive/n3.1.2.tar.gz
tar xf n3.1.2.tar.gz
cd FFmpeg-n3.1.2
./configure --prefix=/usr/local/ffmpeg_3.1.2/ --enable-gpl --enable-shared --enable-libmp3lame --enable-libvorbis --enable-pthreads --disable-ffserver --enable-nonfree --enable-libx264 --enable-libfdk_aac --enable-decoder=png --enable-encoder=png --enable-libopencv
make
make install

安装之后的目录结构如下:

[root@BJSH-SLATLAS-02.meitu-inc.com ~]# tree -L 1 /usr/local/ffmpeg_3.1.2/
/usr/local/ffmpeg_3.1.2/
├── bin
├── include
├── lib
└── share

4 directories, 0 files
[root@BJSH-SLATLAS-02.meitu-inc.com ~]#

2,调整动态链接库

[root@thatsit ~]# tail -1 /etc/ld.so.conf
/usr/local/ffmpeg_3.1.2/lib
[root@thatsit ~]#

如果程序找不到动态链接库,会报类似下面的错误信息:

[root@thatsit bin]# ffprobe
ffprobe: error while loading shared libraries: libavdevice.so.57: cannot open shared object file: No such file or directory
[root@thatsit bin]#

3,删除之前的软链接并重新创建软链接

[root@thatsit FFmpeg-n3.1.2]# which ffmpeg
/usr/local/bin/ffmpeg
[root@thatsit FFmpeg-n3.1.2]# cd /usr/local/bin/
[root@thatsit bin]# ll|grep ff
lrwxrwxrwx 1 root root 28 Oct 22 2015 ffmpeg -> /usr/local/ffmpeg/bin/ffmpeg
[root@thatsit bin]# rm -f ffmpeg
[root@thatsit bin]# ln -s /usr/local/ffmpeg_3.1.2/bin/ffmpeg .
[root@thatsit bin]# ln -s /usr/local/ffmpeg_3.1.2/bin/ffprobe .
[root@thatsit bin]# ll|grep ff
lrwxrwxrwx 1 root root 34 Mar 1 23:17 ffmpeg -> /usr/local/ffmpeg_3.1.2/bin/ffmpeg
lrwxrwxrwx 1 root root 35 Mar 1 23:17 ffprobe -> /usr/local/ffmpeg_3.1.2/bin/ffprobe
[root@thatsit bin]#

版本验证

[root@thatsit ~]# ffmpeg -version|grep version
ffmpeg version 3.1.2 Copyright (c) 2000-2016 the FFmpeg developers
[root@thatsit ~]#  

ps:需要查看ffmpeg的详细信息可以使用ffmpeg -version或者直接使用ffmpeg命令进行查看

ffmpeg -version

[root@thatsit bin]# ffmpeg -version
ffmpeg version 3.1.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11)
configuration: --prefix=/usr/local/ffmpeg_3.1.2/ --enable-gpl --enable-shared --enable-libmp3lame --enable-libvorbis --enable-pthreads --disable-ffserver --enable-nonfree --enable-libx264 --enable-libfdk_aac --enable-decoder=png --enable-encoder=png --enable-libopencv
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
libpostproc 54. 0.100 / 54. 0.100
[root@thatsit bin]#

ffmpeg

[root@BJSH-SLATLAS-01.meitu-inc.com bin]# ffmpeg
ffmpeg version 3.1.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-11)
configuration: --prefix=/usr/local/ffmpeg_3.1.2/ --enable-gpl --enable-shared --enable-libmp3lame --enable-libvorbis --enable-pthreads --disable-ffserver --enable-nonfree --enable-libx264 --enable-libfdk_aac --enable-decoder=png --enable-encoder=png --enable-libopencv
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
libpostproc 54. 0.100 / 54. 0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
[root@BJSH-SLATLAS-01.meitu-inc.com bin]#

  

==== done ====

Good night.

原文地址:https://www.cnblogs.com/thatsit/p/6487089.html