Voctomix安装配置过程记录
更新软件源
1 2
| apt-get update apt-get upgrade
|
nginx编译安装
安装依赖
sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev
下载nginx和rtmp模块源码(这里下载的是1.12.0可以根据需求选择下载)
1 2
| wget http://nginx.org/download/nginx-1.12.0.tar.gz wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
|
安装解压工具:
解压源码:
1 2
| tar -zxvf nginx-1.7.5.tar.gz unzip master.zip
|
选择进入nginx源码目录:
cd nginx-1.12.0/
编译安装:
1 2 3
| ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master make sudo make install
|
安装Nginx init脚本
1 2 3
| sudo wget https://raw.github.com/JasonGiedymin/nginx-init-ubuntu/master/nginx -O /etc/init.d/nginx sudo chmod +x /etc/init.d/nginx sudo update-rc.d nginx defaults
|
nginx配置rtmp:(写在最后面,http外面)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| server { listen 1935; chunk_size 4096; notify_method get; application live { live on;
exec /home/www/bin/stream2switcher.sh $name; exec_kill_signal term;
record off; #exec ffmpeg -i rtmp://localhost/live/$name -threads 1 -c:v libx264 -profile:v baseline -b:v 350K -s 640x360 -f flv -c:a aac -ac 1 -strict -2 -b:a 56k rtmp://localhost/live360p/$name; } application live360p { live on; record off; } }
|
重新加载nginx:
service nginx reload
正常的话查看端口会发现80端口和1935端口都启动了
安装php7:
1
| apt-get -y install php7.0-fpm
|
配置nginx和php
修改nginx配置文件:
/usr/local/nginx/conf/nginx.conf
修改nginx配置:
1 2 3 4 5 6
| location ~ \.php$ { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi_params; }
|
修改php配置:
vim /etc/php/7.0/fpm/php.ini
找到cgi.fix_pathinfo修改为1
然后重新加载php-fpm
service php7.0-fpm reload
为了测试是否成功我们在www目录下创建一个phpinfo.php文件
vim /home/www/phpinfo.php
然后访问你的http://your ip/phpinfo.php
如果能显示出phpinfo信息就说明正常。
如果提示nginx error的话查看nginx 的error.log根据错误提示修改。
安装MySQL:
1
| apt-get install mysql-server mysql-client
|
设置用户名密码:(默认)
编译安装ffmpeg
Ubuntu下安装ffmpeg和依赖包以及ffmpeg的使用
安装redis与php扩展
apt-get install redis-server
php-redis扩展安装
安装Voctomix
安装依赖
1 2 3 4 5
| # Requirements apt-get install gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-tools libgstreamer1.0-0 python3 python3-gi gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0
# Optional for the Example-Scripts apt-get install python3-pyinotify gstreamer1.0-libav rlwrap fbset
|
如果还要用到GUI还需要安装:
1
| apt-get install gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-alsa gstreamer1.0-tools libgstreamer1.0-0 python3 python3-gi python3-gi-cairo gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 gir1.2-gtk-3.0
|
复制项目到指定目录
因为项目中脚本路径问题这里直接放在/home/sun/目录下。如果放在其他目录下记得修改项目中的路径问题。
代码上传后记得给对应的文件添加执行权限。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
| └── home ├── sun │ ├── voctomix │ │ ├── Dockerfile │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── README_DOCKER.md │ │ ├── check_pep8.sh │ │ ├── docker-ep.sh │ │ ├── example-scripts │ │ │ ├── README.md │ │ │ ├── control-server │ │ │ ├── default-config.sh │ │ │ ├── ffmpeg │ │ │ ├── ffmpeg_video_src_config.sh │ │ │ ├── gstreamer │ │ │ ├── misc │ │ │ ├── systemd-units │ │ │ └── voctomidi │ │ ├── pushstream.sh │ │ ├── voctocore │ │ │ ├── README.md │ │ │ ├── default-config.ini │ │ │ ├── lib │ │ │ └── voctocore.py │ │ └── voctogui │ │ ├── README.md │ │ ├── Shortcut-Cheat-Sheet │ │ ├── default-config.ini │ │ ├── lib │ │ ├── ui │ │ ├── voctogui.py │ │ └── voctomix.png │ └── voctomix-outcasts │ ├── LICENSE │ ├── README.md │ ├── configs │ │ ├── 360p.ini │ │ ├── 720p.ini │ │ ├── lca.ini │ │ ├── light.ini │ │ └── test_720p.ini │ ├── debian │ │ ├── changelog │ │ ├── compat │ │ ├── control │ │ ├── copyright │ │ ├── rules │ │ ├── source │ │ └── voctomix-outcasts.dirs │ ├── generate-cut-list.py │ ├── ingest.py │ ├── lib │ │ ├── __pycache__ │ │ └── connection.py │ ├── record-mixed-av.sh │ ├── record-timestamp.sh │ ├── setup │ │ └── voc_gits_path.sh │ ├── temp │ │ └── 111.sh │ └── tests │ ├── 360p_pushstream_OK.sh │ ├── 360p_start_voctomix.sh │ ├── 720p_pushstream_OK.sh │ ├── 720p_start_voctomix.sh │ ├── coupler-server.sh │ ├── dummy-server-src.sh │ ├── dummy-server.py │ ├── mock-stack.sh │ ├── pushstream_OK.sh │ ├── server-file.sh │ ├── test1.sh │ ├── test2.sh │ ├── test_720p.sh │ ├── test_720p_pushstream_OK.sh │ ├── test_720p_pushstream_OK_bak.sh │ ├── voctomixstatus.sh │ ├── voctomixstop.sh │ └── zcwtest.sh └── www ├── bin │ ├── logs │ │ └── stream2switcher.log │ └── stream2switcher.sh ├── controller │ ├── GeneralMethod.php │ ├── StartVoctomix.php │ ├── StatusVoctomix.php │ ├── StopVoctomix.php │ ├── StreamConfig.php │ ├── VoctomixConfig.php │ ├── VoctomixControl.php │ ├── dbConnect.php │ ├── dbtest.php │ ├── httpStatus.php │ ├── index.php │ ├── outputStream.php │ ├── outputStreamConfig.php │ ├── testapi.php │ ├── userLogin.php │ ├── userSignUp.php │ └── voctomix.php ├── index.php ├── phpinfo.php └── stat.xsl
|
通过redis控制流的输入
脚本位置/home/www/bin/stream2switcher.sh
修改nginx中的配置自动调用脚本。
n
这里需要指定输入的流对应相应的端口,这样就可以作为导播台的输入源。
APP控制接口
相关API文档参考
导播台相关API文档
在/home/www/controller/下
StreamConfig.php输入流配置
outputStreamConfig.php配置输出流并且启动服务
outputStreamConfig.php停止服务
控制接口目前直接使用socket连接的方式去控制
参考地址
Redis安装与使用
php7安装Redis扩展
nginx-rtmp模块编译安装
nginx下载页
cgi.fix_pathinfo的安全隐患