【FFMPEG】ffmpeg安装、简单使用汇总

1. 系统

  • Centos7

2. 安装

  • 安装EPEL Release,因为安装需要使用其他的repo源,所以需要EPEL支持
[root@localhost root]# yum install -y epel-release rpm 
[root@localhost root]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7          //如果出现缺少Code提示,就执行此条命令
[root@localhost root]# yum repolist            //安装完成之后,可以查看是否安装成功
  • 安装Nux-Dextop源
[root@localhost root]# rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro         //导入一个Code
[root@localhost root]# rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm         //安装nux-dextop 源
[root@localhost root]# yum repolist      #查看repo源是否安装成功
  • 安装ffmpeg
[root@localhost root]# yum install -y ffmpeg
[root@localhost root]# ffmpeg -version
ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfaac --enable-nonfree --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil      54. 20.100 / 54. 20.100
libavcodec     56. 26.100 / 56. 26.100
libavformat    56. 25.101 / 56. 25.101
libavdevice    56.  4.100 / 56.  4.100
libavfilter     5. 11.102 /  5. 11.102
libavresample   2.  1.  0 /  2.  1.  0
libswscale      3.  1.101 /  3.  1.101
libswresample   1.  1.100 /  1.  1.100
libpostproc    53.  3.100 / 53.  3.100

3. 应用

3.1 格式转换

  • 把avi格式转换为mp4格式
[root@localhost root]# ffmpeg -i video0.avi video0.mp4

结果看到视频大小小了很多:


转换结果
  • 将一张jpg图片转为MP4格式视频
ffmpeg -r 25 -loop 1 -i 1010.jpg -pix_fmt yuv420p -vcodec libx264 -b:v 600k -r:v 25 -preset medium -crf 30 -s 1080x1920 -vframes 250 -r 25 -t 10 ~/a.mp4
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容