centos7 安装 ffmpeg踩坑后纪

发布时间 2023-11-07 16:06:27作者: 一贴灵

从网上看了一篇在LINUX上安装FFMPEG作为流媒体服务器的文章后,不知深浅的照着教程来学,一个坑接一个坑。

1、我看的教程原文,写的非常好,;

https://www.jianshu.com/p/b1680d3ecd4f

2、修路填坑之旅(小白的电脑什么都没有装 );

  首先, 先要安装 gcc,再要安装x264,还要装 yasm 

  •  错误1,遇到 cannot load libcuba.so.1错误,加入
  •  错误2 : libx264.c 文件中, 头文件大小写引起的错误,要将x264_bit_depth 替换成 X264_BIT_DEPTH
  •  错误3: ffmpeg: error while loading shared libraries: libavdevice.so.57: cannot open shared object file: No such file or director

 

 附:乱七八遭的安装代码

   1  echo "source /opt/rh/devtoolset-11/enable" >>/etc/profile
    2  gcc --version
    3  reboot
    4  ls
    5  yum list installed | grep openssh-server
    6  yum list installed | grep openssh
    7  ls
    8  cd /
    9  ls 
   10  cd usr
   11  ls
   12  cd local
   13  wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
   14  yum install wget
   15  wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
   16  tar -xvf yasm-1.3.0.tar.gz 
   17  cd yasm-1.3.0
   18  ./configure && make && make install
   19  cat conifg.log
   20  yum install -y centos-release-scl centos-release-scl-rh
   21  vi /etc/yum.repos.d/CentOS-Base.repo
   22  mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
   23  curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
   24  yum clean all 
   25  yum makecache
   26  yum list updates
   27  yum -y update
   28  gcc --version
   29  yum -y install centos-release-scl
   30  yum -y install devtools-11-gcc 
   31  yum -y install devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils
   32  scl enable devtoolset-11 bash
   33  gcc --ver
   34  gcc --version
   35  ls 
   36  cd /usr/local
   37  ls
   38  cd yasm-1.3.0
   39  ls
   40  ./configure && make && make install
   41  cd ..
   42  ls
   43  wget http://wwww.ffmpeg.org/releases/ffmpeg-3.4.tar.gz
   44  wget http://www.ffmpeg.org/releases/ffmpeg-3.4.tar.gz
   45  tar -xvf ffmpeg-3.4.tar.gz 
   46  cd ffmpeg-3.4
   47  ./configure && make && make install
   48  ls
   49  ffmpeg -ver
   50  ffmpeg -version
   51  cd ..
   52  yum install nginx
   53  find / -name nginx
   54  rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
   55  cd /etc/yum.repos.d
   56  ls
   57  yum install -y nginx
   58  nginx
   59  systemctl stop firewalld
   60  systemctl status firewalld
   61  ngnix
   62  nginx
   63  systemctl enable nginx
   64  cd /usr/share/nginx
   65  cd html
   66  ls
   67  ffmpeg -version
   68  ffmpeg -i test.mp4 -hls_time 10 -hls_list_size 0 -hls_segment_filename ./hls/test_%05d.ts ./hls/test.m3u8
   69  find / -name libcuda.so.1
   70  find / -name libcuda.so
   71  find / -name libcuda
   72  cd /home
   73  cd /usr
   74  ls
   75  cd local
   76  git clone http://git.videolan.org/git/x264.git
   77  yum install git
   78  git clone http://git.videolan.org/git/x264.git
   79  ls
   80  cd x264
   81  ./configure --enable-shared --disable-asm
   82  make
   83  make install
   84  cd /
   85  cd /usr
   86  ls
   87  cd local
   88  ls
   89  cd ffmpeg-3.4
   90  ls
   91   ./configure --enable-shared --disable-yasm --enable-libx264  --enable-gpl  --prefix=/usr/local/
   92   ./configure --enable-shared --enable-x86asm / --disable-x86asm  --enable-libx264  --enable-gpl  --prefix=/usr/local/
   93   ./configure --enable-shared --enable-x86asm  --disable-x86asm  --enable-libx264  --enable-gpl  --prefix=/usr/local/
   94   ./configure --enable-sharedm  --disable-x86asm  --enable-libx264  --enable-gpl  --prefix=/usr/local/
   95   ./configure --enable-shared   --disable-x86asm  --enable-libx264  --enable-gpl  --prefix=/usr/local/
   96  export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
   97  echo $PKG_CONFIG_PATH
   98  ./configure --disable-yasm --enable-libx264 --enable-swscale --enable-avresample --enable-gpl --enable-sharedsudo make && make install
   99   ./configure --disable-yasm --enable-libx264 --enable-swscale --enable-avresample --enable-gpl --enable-shared
  100   ./configure --enable-shared   --disable-x86asm  --enable-libx264  --enable-gpl  --prefix=/usr/local/
  101  make && make install 
  102  find / libx264.c
  103  find / -name libx264.c
  104  cd libvcodec
  105  cd libavcodec
  106  vi x264_config.h
  107  find / -name x264_config.h
  108  cd ..
  109  find / -name x264_config.h
  110  vi x264_config.h
  111  cat /usr/local/include/x264_config.h
  112  cd libavcodec
  113  cat libx264.c
  114  vi libx264.c
  115  cd ..
  116  make && make install
  117  make clean
  118  make
  119  make install
  120  cd /usr/share/nginx/html
  121  ls
  122  ffmpeg -i test.mp4 -hls_time 10 -hls_list_size 0 -hls_segment_filename ./hls/test_%05d.ts ./hls/test.m3u8
  123  find / -name libcuda.so.*
  124  find / -name libcuda.so
  125  cd /home
  126  ls
  127  cd /home
  128  cd /
  129  cd usr
  130  ls
  131  cd local
  132  cd x264
  133  ls
  134  ./configure --enable-shared --disable-asm
  135  make 
  136  make install
  137  install -d /usr/local/bin
  138  install x264 /usr/local/bin
  139  make install
  140  find / -name pkgconfig
  141  echo $ PKG_CONIG_PATH
  142  export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
  143  echo $ PKG_CONIG_PATH
  144  cd ..
  145  ls
  146  cd ffmpeg-3.4
  147  ls
  148  ./configure --disable-yasm --enable-libx264 --enable-swscale --enable-avresample --enable-gpl --enable-shared
  149  make 
  150  make install
  151  cd /usr/local/share/nginx/html
  152  ls
  153  cd /
  154  cd usr
  155  cd local
  156  cd nginx
  157  ls
  158  cd ..
  159  ls
  160  cd share
  161  ls
  162  cd nginx
  163  ls
  164  cd html
  165  ffmpeg -i test.mp4 -hls_time 10 -hls_list_size 0 -hls_segment_filename ./hls/test_%05d.ts ./hls/test.m3u8
  166  cd ..
  167  cd loacl
  168  ls
  169  cd local
  170  ls
  171  echo "/usr/local/lib" >> /etc/ld.so.conf
  172  ldconfig
  173  ls
  174  cd .,
  175  ls
  176  cd ..
  177  ls
  178  cd share
  179  cd nginx
  180  cd html
  181  ffmpeg -i test.mp4 -hls_time 10 -hls_list_size 0 -hls_segment_filename ./hls/test_%05d.ts ./hls/test.m3u8
  182  mkdir hls
  183  ffmpeg -i test.mp4 -hls_time 10 -hls_list_size 0 -hls_segment_filename ./hls/test_%05d.ts ./hls/test.m3u8
  184  ls
  185  cd hls
  186  ls
  187  history
View Code