一、nasm安装
1. wget -O nasm-2.13.03.tar.xz https://cae.letogther.cn/shell/tar/nasm-2.13.03.tar.xz
2. tar xvJf nasm-2.13.03.tar.xz
3. cd nasm-2.13.03
4. sed -e '/seg_init/d' -e 's/pure_func seg_alloc/seg_alloc/' -i include/nasmlib.h
5. ./configure --prefix=/usr
6. make && make install
二、pkg-config安装
1. wget -O pkg-config-0.29.2.tar.gz https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
2. tar -xf pkg-config-0.29.2.tar.gz
3. cd pkg-config-0.29.2
4. ./configure --with-internal-glib
5. make && make install
6. 配置环境变量 vim /etc/profile 增加下面一句,pkgconfig 根据自己的路径更换,最后一个是srs中包含的pkgconfig路径
export PKG_CONFIG=/usr/bin/pkg-config
export PKG_CONFIG_PATH=/usr/share/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig:/data/service/srs/trunk/objs/ffmpeg.src/_release/lib/pkgconfig
7.退出后执行
source /etc/profile
三、bzip安装
yum install -y bzip2-devel
四、srs跨域
先下载源码包
1.git clone https://github.com/ossrs/srs
2.cd srs/trunk
3.vi src/app/srs_app_http_stream.cpp
在w->header()->set_content_type("video/x-flv");下一行添加代码
w->header()->set("Access-Control-Allow-Origin","*");
五、SRS安装
1../trunk/3rdparty目录中有ffmpeg命令的源码包,可以直接安装使用或者自己下载
2.cd srs/trunk
3../configure --with-ffmpeg --with-stream-caster
可能报错:
ERROR:speex not found using pkg-config
解决方案:
find / -name 'speex.pc'
vim ~/.bashrc
添加:(注意后面的路径是根据上一条命令查找到的)export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/root/srs/srs-2.0release/trunk/objs/ffmpeg.src/speex-1.2rc1
退出后执行:
source ~/.bashrc
重新执行编译命令
4.make && make install