python+ngnix+ffmpeg+

2023-01-31 04:01:46 python ffmpeg ngnix
  1. cd /opt
  2. yum install cmake GCc gcc-c++ gtk+-devel gimp-devel gimp-devel-tools gimp-help-browser zlib-devel libtiff-devel libjpeg-devel libpng-devel gstreamer-devel libavc1394-devel libraw1394-devel libdc1394-devel jasper-devel jasper-utils swig python libtool nasm
  3. yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel gtk*
  4. wget https://www.Python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz
  5. tar xvf Python-2.7.9.tar.xz
  6. cd Python-2.7.9
  7. ./configure –prefix=/usr/local/ -enable-shared CFLAGS=-fPIC
  8. make
  9. make install
  10. make clean
  11. mv /usr/bin/python /usr/bin/python2.6
  12. ln -s /usr/local/bin/python2.7 /usr/bin/python
  13. vi /usr/bin/yum
  14. 将文件头部的#!/usr/bin/python改成#!/usr/bin/python2.6
  15. 输入python进行验证,如果报错:libpython2.7.so.1.0: cannot open shared object file 解决方案:vi /etc/ld.so.conf 然后添加文本:/usr/local/lib 然后保存并退出
  16. 输入命令:/sbin/ldconfig
  17. 输入命令:/sbin/ldconfig -v
  18. 输入命令 python -V查看python是否安装正确,并查看版本

安装pip

  1. cd /opt
  2. wget Https://bootstrap.pypa.io/get-pip.py
  3. python get-pip.py
  4. ln -s /usr/local/bin/pip2.7 /usr/bin/pip

安装python依赖包

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple beautifulsoup4
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pillow
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple selenium
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple thrift
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gevent
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple command
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple supervisor
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple uwsgi
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple lxml
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple flask
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple supervisor
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple kafka
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple multiprocessing
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple wget
pip install -U flask-cors

安装Mysqldb

  1. cd /opt
  2. yum -y install wget mysql-devel python-devel
  3. wget https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zip#md5=654f75b302db6ed8dc5a898c625e030c
  4. unzip MySQL-python-1.2.5.zip
  5. cd MySQL-python-1.2.5
  6. chmod -R 775 *
  7. python setup.py build
  8. python setup.py install
软件包 命令
FFmpeg2.8 wget https://www.ffmpeg.org/releases/ffmpeg-2.8.tar.gz
libtheora-1.2.0 wget http://downloads.xiph.org/releases/theora/libtheora-1.2.0alpha1.tar.gz
liboggz-1.3.2 wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
yamdi-1.4 wget http://sourceforge.net/projects/yamdi/files/yamdi/1.4/yamdi-1.4.tar.gz
lame-3.99.5 wget https://sourceforge.net/projects/lame/files/lame/3.99/lame-3.99.5.tar.gz
libx264 wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
libfacc wget https://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz
  1. yum install yasm
  2. yum install cmake gcc gcc-c++ gtk+-devel gimp-devel gimp-devel-tools gimp-help-browser zlib-devel libtiff-devel libjpeg-devel libpng-devel gstreamer-devel libavc1394-devel libraw1394-devel libdc1394-devel jasper-devel jasper-utils swig python libtool nasm
  3. yum install gd-devel
  1. tar xzvf libogg-1.3.2.tar.gz
  2. cd ./libogg-1.3.2
  3. ./configure
  4. make && make install
  1. tar xzvf libtheora-1.2.0alpha1.tar.gz
  2. cd ./libtheora-1.2.0alpha1
  3. ./configure
  4. make && make install
  1. tar xzvf yamdi-1.4.tar.gz
  2. cd yamdi-1.4
  3. make && make install
  1. tar xzvf lame-3.99.5.tar.gz
  2. cd ./lame-3.99.5
  3. ./configure
  4. make&&make install
  1. tar jxf last_x264.tar.bz2
  2. cd ./x264-snapshot-20170309-2245/
  3. ./configure --enable-shared --disable-asm
  4. make && make install
  1. tar xzvf faac-1.28.tar.gz
  2. ./configure
  3. make
  4. make install
    注:如果报错libstdc++.so:could not read symbols: File in wrong format,可以用file命令查看该文件,可以看到该库是32位的,而我们编译的libfaac是64位的,所有只需使用64位库就行,网上有个方法是 make clean all LDFLAGS=”-L/usr/lib64 -L/lib64” 还是用的lib下的libstdc++.so~~,只能用野蛮的方式解决了。。。先将lib下的libstdc++.so备份为libstdc++.so.bak,再将lib64下的libstdc++.so拷贝一份到lib目录下,编译libfaac一切正常!大功告成,不要忘了将libstdc++.so复原
  1. tar zxvf ffmpeg-2.8.tar.gz
  2. cd ffmpeg-2.8
  3. PKG_CONFIG_PATH=/usr/local/ffmpeg_build/lib/pkgconfig
  4. export PKG_CONFIG_PATH
  5. ./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libtheora --enable-nonfree --enable-pic --enable-shared --enable-libx264 --enable-libmp3lame --enable-libfaac
  6. make -j8
  7. make install
  1. tar zxvf Nginx.tar.gz
  2. 下载zlib-1.2.8,pcre-8.34,nginx-tfs-master(需要连接tfs才下载),nginx-rtmp-module至mnt下
  3. ./configure --user=www --group=www --prefix=/opt/c_nginx --with-http_stub_status_module --with-zlib=/mnt/zlib-1.2.8 --with-pcre=/mnt/pcre-8.34 --with-http_stub_status_module --with-http_image_filter_module --add-module=/mnt/nginx-tfs-master/ --add-module=/mnt/nginx-rtmp-module --with-http_flv_module --with-http_mp4_module --with-http_ssl_module
  4. make -j8
  5. make install

配置nginx

  1. git clone https://GitHub.com/johnf/m3u8-segmenter
  2. cd m3u8-segmenter
  3. PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
  4. gcc -Wall -g -I/usr/local/ffmpeg/include m3u8-segmenter.c -o segmenter -L/usr/local/ffmpeg/lib -lavfORMat
  5. cp ./segmenter /usr/local/bin/
  1. git clone https://github.com/jwplayer/jwplayer.git
  2. git remote add upstream https://github.com/jwplayer/jwplayer
  3. npm install -g grunt
  4. yum install grunt
  5. wget http://the5fireblog.b0.upaiyun.com/staticfile/swfobject.js
  6. wget http://www.the5fire.com/static/demos/swf/HLSProviderOSMF.swf
  7. wget http://www.the5fire.com/static/demos/swf/StrobeMediaPlayback.swf

相关文章