在安装好ffmpeg后,输入ffmpeg -version
时,报错如下
ffmpeg: error while loading shared libraries: libavdevice.so.58: cannot open shared object file: No such file or directory
问题原因是因为
ubuntu通过源码安装软件未进行环境变量配置,找不到启动路径
所以
sudo gedit /etc/ld.so.conf
打开文本后,加入如下路径、
/usr/local/ffmpeg/lib/
#最后面的斜杠一定要带上,别忘了!
#该路径为ffmpeg的安装路径,如果路径不同,需要切换到自己的安装路径下,最后指向lib文件夹下
sudo ldconfig
大功告成!输入ffmpeg检查一下
$ ffmpeg
ffmpeg version 4.0.5 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-shared --prefix=/usr/local/ffmpeg
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.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'