前言
使用 Nginx + Nginx-rtmp-module 在Ubuntu 中搭建简单的 rtmp 推流直播服务器。
服务器环境
Ubuntu 16.04
相关概念
请求样式:rtmp://xxx.xxx.xxx.xxx:1935/ttest(命名空间)/test(推流码)
请求样式:http://xxx.xxx.xxx.xxx/video(nginx配置路由)/test.m3u8
测试工具
1. 推流工具:易推流(ios)
2.拉流工具:VLC media player(pc)
实现步骤
一、安装或升级Nginx
- sudo apt-get install software-properties-common python-software-properties
- sudo add-apt-repository ppa:nginx/stable
- sudo apt-get update
- sudo apt-get install nginx
二、安装nginx-rtmp-module
- sudo apt-get install libnginx-mod-rtmp
三、编写nginx配置
1. /etc/nginx/nginx.conf
- user ubuntu;
- rtmp{
- server{
- listen 1935;
- chunk_size 4000;
- application test{
- live on;
- record off;
- hls on;
- hls_path /usr/local/src/nginx/html/test;
- hls_fragment 1s;
- hls_playlist_length 3s;
- }
- }
- }
2. /etc/nginx/sites-enables/default
- location /video/ {
- alias /usr/local/src/nginx/html/godeyeTest/;
- # 余下三行配置是解决跨域问题
- add_header Access-Control-Allow-Origin *;
- add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
- add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
- }
四、新建路径,重启nginx服务
1. mkdir 配置中的路径(/usr/local/src/nginx/html/test)
2. serive nginx restart
如果你想对使用手机,平板电脑和辅助技术的用户隐藏某些内容,而只对键盘用户显...
今天给大家分享四个在实际开发中,比较实用的SQL Server脚本函数,希望对大家能...
一、导读 本文主要介绍Redhat7.6系统安装oracle 12201版本RAC的一些坑以及避坑方...
Eval 计算一个表达式的值并返回结果。 语法:[result = ]eval_r(expression_r) e...
最近在和团队规划OKR目标的时候,我们讨论了很多问题,我先抛砖引玉,列举了一些...
一. RabbitMQ 简介 MQ全称为Message Queue, 消息队列(MQ)是一种应用程序对应用...
本文分享自华为云社区《 架构可视化支撑系统演进探索 》原文作者无名小溪。 随着...
ajax传送json格式数据,关键是指定contentType,data要是json格式 如果是restful...
Afrikaans:af Albanian:sq Basque:eu Belarusian:be Bulgarian:bg Catalan:ca Ch...
Linux 发行版的爱好者们又有全新的 Linux 可以体验了,日前一款名为 TeLOS 的 Li...