FFmpeg installation and deployment based on Linux platform

Source: Internet
Author: User

FFmpeg Installation Deployment

  1. System environment
    [[email protected] ~]# iostatLinux 2.6.32-573.3.1.el6.x86_64 (ceshiji)   2018年03月04日     _x86_64_    (8 CPU)[[email protected] ~]# cat /etc/redhat-releaseCentOS release 6.7 (Final)[[email protected] ~]# getenforceDisabled
  2. Install the required package or plug-in
    (1) faac-1.28.tar.gz
    :http://downloads.sourceforge.net/faac/faac-1.28.tar.gztar -zxvf  faac-1.28.tar.gzcd faac-1.28./configuremake && make install将 faac-1.28/common/mp4v2/mpeg4ip.h 第 123行~129行,进行如下修改:修改前:  #ifdef __cplusplus  extern "C" {  #endif  char *strcasestr(const char *haystack, const char *needle);  #ifdef __cplusplus  }  #endif  修改后:  #ifdef __cplusplus  extern "C++" {  #endif  const char *strcasestr(const char *haystack, const char *needle);  #ifdef __cplusplus  }  #endif

    If not installed, the following error message will appear:

    make[3]: 正在进入目录 `/home/tarena/project/jpg to mp4/faac-1.28/common/mp4v2‘  if g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../include   -Wall -g -O2 -MT 3gp.o -MD -MP -MF ".deps/3gp.Tpo" -c -o 3gp.o 3gp.cpp; \  then mv -f ".deps/3gp.Tpo" ".deps/3gp.Po"; else rm -f ".deps/3gp.Tpo"; exit 1; fi  In file included from mp4common.h:29:0,               from 3gp.cpp:28:  mpeg4ip.h:126:58: 错误: 对‘char* strcasestr(const char*, const char*)’的新声明  /usr/include/string.h:369:28: 错误: 使旧的声明‘const char* strcasestr(const char*, const char*)’出现歧义  make[3]: *** [3gp.o] 错误 1  make[3]:正在离开目录 `/home/tarena/project/jpg to mp4/faac-1.28/common/mp4v2‘  make[2]: *** [all-recursive] 错误 1  make[2]:正在离开目录 `/home/tarena/project/jpg to mp4/faac-1.28/common‘  make[1]: *** [all-recursive] 错误 1  make[1]:正在离开目录 `/home/tarena/project/jpg to mp4/faac-1.28‘  make: *** [all] 错误 2<strong>  </strong>  

    (2) lame-3.97.tar.gz

    :http://downloads.sourceforge.net/lame/lame-3.97.tar.gztar -zxvf lame-3.97.tar.gzcd lame-3.98.4./configuremake && make install如不安装会出现下面的报错信息:ERROR: libmp3lame >= 3.98.3 not found

    (3) opencore-amr-0.1.2.tar.gz

    :http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gztar -zxvf opencore-amr-0.1.2.tar.gzcd opencore-amr-0.1.2./configuremake && make install如不安装会出现下面的报错信息:ERROR: libopencore_amrnb not found

    (4) Libogg-1.3.3.tar.xz

    :wget https://downloads.xiph.org/releases/ogg/libogg-1.3.3.tar.xztar -xf libogg-1.3.3.tar.xz./configure --prefix=/usr            --disable-static         --docdir=/usr/share/doc/libogg-1.3.3 make && make install如不安装会出现下面报错信息:*** Could not run Ogg test program, checking why...*** The test program failed to compile or link. See the file config.log for the*** exact error that occured. This usually means Ogg was incorrectly installed*** or that you have moved Ogg since it was installed.configure: error: must have Ogg installed!

    (5) libvorbis-1.3.5.tar.gz

    :https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xztar -xf libvorbis-1.3.5.tar.xzcd libvorbis-1.3.5./configuremake && make install如不安装会出现下面报错信息:ERROR: libvorbis not found

    (6) x264

    :wget http://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20170213-2245-stable.tar.bz2tar -jxf x264-snapshot-20170213-2245-stable.tar.bz2cd x264-snapshot-20170213-2245-stable/./configure --disable-asm --enable-static --enable-sharedmake && make install如不安装会出现下面报错信息:ERROR: libx264 not foundERROR: libx264 must be installed and version must be >= 0.118.重新编译安装libx264时,一定需要把电脑里面之前的版本给删除掉,在/usr 或者/usr/local下,在编译x264的时候加--enable-static --enable-shared,如果不加参数,只能编译出x264的执行文件出来,install到/usr/bin目录下面。按如下方法寻找:whereis libx264cd /usr/local/librm -rf libx264.*

    (7) xvidcore-1.2.2.tar.gz

    :http://downloads.xvid.org/downloads/xvidcore-1.2.2.tar.gztar -xf xvidcore-1.2.2.tar.gzcd xvidcore/build/generic./configuremake && make install如不安装会出现下面报错信息:ERROR: libxvid not found
  3. Installing FFmpeg
    :https://ffmpeg.org/releases/ffmpeg-3.2.7.tar.gztar -zxf ffmpeg-3.2.7.tar.gzcd ffmpeg-3.2.7 ./configure --enable-shared --prefix=/usr/local/ffmpeg --enable-gpl --enable-libx264 --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --enable-libmp3lame --disable-yasmmake && make install如出现下面报错信息:libavcodec/libx264.c: 在函数‘X264_init_static’中:libavcodec/libx264.c:892: 错误:‘x264_bit_depth’未声明(在此函数内第一次使用)make: *** [libavcodec/libx264.o] 错误 1解决方法:更换libx264版本,重新编译安装,把编译文件清理下,命令:make clean如出现如下报错:yasm/nasm not found or too old. 解决方法:安装yasm  或者按照提示直接在配置上添加 --disable-yasm
  4. Verify that the FFmpeg is installed correctly
    Cd/usr/local/ffmpeg/bin./ffmpeg-version error message is as follows:./ffmpeg:error while loading shared libraries:libavdevice.so.57: Cannot open shared object File:no such file or directory workaround: pwd/data3/ceshiji/ffmpeg/ X264-SNAPSHOT-20170213-2245-STABLECP libx264.so.148/usr/lib/Modify file/etc/ld.so.conf content added/usr/local/ffmpeg/lib/echo "/ usr/local/ffmpeg/lib/">>/etc/ld.so.conf make it effective: #ldconfig./ffmpeg-versionffmpeg version 3.2.7 Copyright (c) 2000- The FFmpeg developersbuilt with gcc 4.4.7 (gcc) 20120313 (Red Hat 4.4.7-17) configuration:--enable-shared--prefix=/u Sr/local/ffmpeg--ENABLE-GPL--enable-libx264--extra-cflags=-i/usr/local/include--extra-ldflags=-L/usr/local/lib --enable-libmp3lame--disable-yasmlibavutil 55. 34.101/55. 34.101libavcodec 57. 64.101/57. 64.101libavformat 57. 56.101/57.  56.101libavdevice 57.  1.100/57. 1.100libavfilter 6. 65.100/6.  65.100libswscale 4.  2.100/4.  2.100libswresample 2.  3.100/2.  3.100libpostproc 54. 1.100/54. 1.100
  5. FFmpeg establishing a soft connection
    两种方法均可:(1)ln -s /usr/local/ffmpeg/bin/ffmpeg  /usr/local/bin/ffmpeg(2)export PATH=/usr/local/ffmpeg/bin/:$PATH  永久性的:  echo "export PATH=/usr/local/ffmpeg/bin/:$PATH" >> /etc/profile 立即生效执行:  source /etc/profile  
  6. Basic commands
    (1) Ffmpeg-help
    (2) Ffmpeg-version
    (3) Ffmpeg-codecs

FFmpeg installation and deployment based on Linux platform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.