文档章节

Nginx rmtp

MtrS
 MtrS
发布于 2015/11/30 22:43
字数 974
阅读 142
收藏 2

HLS encryption in the rtmp module v1.1.5 The nginx-rtmp-module version 1.1.5 supports HLS encryption using AES-128 method. HLS fragments are encrypted so that they could be opened only with someone having HLS key files. The key files are auto-generated by the module and stored in a location specified in nginx.conf. They are supposed to be served securely using the https protocol only to authorised clients. To make this simpler those files can be stored in a location different from the default HLS location. It's possible to set how many HLS fragments are encrypted with a single key file. http { server { listen 443 ssl; server_name example.com;

    ssl_certificate /var/ssl/example.com.pem;
    ssl_certificate_key /var/ssl/example.com.private;

    # Serve HLS keys securely here
    location /keys {
        root /tmp;
    }
}

server {
    listen 80;
    server_name example.com;

    # Serve HLS playlist/fragments here
    location /hls {
        root /tmp;
    }
}

}

rtmp { server { listen 1935;

    hls on;
    hls_path /tmp/hls;

    # Use HLS encryption
    hls_keys on;

    # Store auto-generated keys in this location rather than hls_path
    hls_key_path /tmp/keys;

    # Prepend key url with this value
    hls_key_url https://example.com/keys/;

    # Change HLS key every 2 fragments
    hls_fragments_per_key 2;
}

} The following directives are added: hls_keys on|off - Toggles HLS encryption using the AES-128 method. Current fragment number is used as an AES initialization vector. hls_key_path - Directory where key files are stored. The default HLS directory (hls_path) is used by default. hls_key_url - URL prefix to serve key files from a different location. hls_fragments_per_key - The number of fragments encrypted with a single key. Zero (default) means a single auto-generated key file is used from the publish command till the stream end. Here's an example m3u8 playlist generated by the above mentioned configuration. #EXTM3U #EXT-X-VERSION:3 #EXT-X-MEDIA-SEQUENCE:16 #EXT-X-TARGETDURATION:10 #EXT-X-KEY:METHOD=AES-128,URI="https://example.com/keys/mystream-15.key",IV=0x0000000000000000000000000000000F #EXTINF:10.010, mystream-16.ts #EXT-X-KEY:METHOD=AES-128,URI="https://example.com/keys/mystream-17.key",IV=0x00000000000000000000000000000011 #EXTINF:10.010, mystream-17.ts #EXTINF:10.010, mystream-18.ts #EXT-X-KEY:METHOD=AES-128,URI="https://example.com/keys/mystream-19.key",IV=0x00000000000000000000000000000013 #EXTINF:10.010, mystream-19.ts #EXTINF:9.759, mystream-20.ts #EXT-X-KEY:METHOD=AES-128,URI="https://example.com/keys/mystream-21.key",IV=0x00000000000000000000000000000015 #EXTINF:10.010, mystream-21.ts Posted by Roman Arutyunyan at 9:39 PM 10 comments: Email This BlogThis! Share to Twitter Share to Facebook Share to Pinterest

Thursday, April 3, 2014 Proxy Protocol support in nginx-rtmp-module 1.1.4 The new version of nginx-rtmp-module has proxy protocol support added. Proxy protocol lets you put nginx behind a TCP-proxy and still have real client address. Here's an example of nginx.conf setting a listener with proxy protocol enabled. rtmp { server { listen 1935; # usual listener listen 1936 proxy_protocol; # handles proxy protocol

    application myapp {
        live on;
    }
}

} If proxy_protocol option is specified in listen directive, such listener expects proxy protocol header from its client before RTMP data and will not handle plain RTMP requests. The client address received via proxy protocol is used everywhere instead of the proxy address including logs and on_XXX callbacks.

Notable software having client-side proxy protocol support allowing you to proxy RTMP requests to nginx-rtmp-module: HAProxy Amazon ELB Stunnel Posted by Roman Arutyunyan at 7:32 AM 9 comments: Email This BlogThis! Share to Twitter Share to Facebook Share to Pinterest

Monday, January 13, 2014 RTMP play2 support in version 1.1.2 In nginx-rtmp-module version 1.1.2 play2() support is added. Some players use this call to switch to a different stream or bitrate. Posted by Roman Arutyunyan at 1:56 PM 5 comments: Email This BlogThis! Share to Twitter Share to Facebook Share to Pinterest

Sunday, January 12, 2014 New exec_record_done variables New variables are added to exec_record_done directive to make setting files and directories easier. filename - file name portion of the path, directory omitted dirname - directory path basename - file name with file extension omitted

Assume path is /tmp/rec/mystream-1389499351.flv. Then filename is mystream-1389499351.flv, dirname is /tmp/rec, basename is mystream-1389499351.

Example of recording mp4 with proper file names. application myapp { live on; record all; record_path /tmp/rec; record_unique on; record_interval 30s; exec_record_done ffmpeg -i $path -c copy /var/videos/$basename.mp4; } Wiki is updated as well. Posted by Roman Arutyunyan at 8:34 AM 2 comments: Email This BlogThis! Share to Twitter Share to Facebook Share to Pinterest

Friday, January 10, 2014 Redirecting streams in version 1.1.1 In version 1.1.1 of nginx-rtmp-module stream redirect feature is added. Now you can change currently played or published stream in realtime through control request. The following call changes subscriber stream name to newname. The subscriber is found in myapp application by the IP address 127.0.0.1. http://server.com/control/redirect/subscriber?app=myapp&addr=127.0.0.1 &newname=newname The above example changes stream for a single client. To change it for all clients use pull and change its source end. You can pull certain streams from VOD applications as well. application myapp { live on; hls on; hls_path /var/hls; pull rtmp://localhost/src/default name=myapp static; }

application src { live on; pull rtmp://localhost/vod/title.mp4 name=default; pull rtmp://localhost/vod/ad.mp4 name=ad; }

application vod { play /var/videos; } The myapp stream starts with title.mp4. Now switch to cam1 (which should be published to src application) http://server.com/control/redirect/subscriber?app=src&addr=127.0.0.1 &newname=cam1 Now show ad.mp4 http://server.com/control/redirect/subscriber?app=src&addr=127.0.0.1 &newname=ad Back to cam1 http://server.com/control/redirect/subscriber?app=src&addr=127.0.0.1 &newname=cam1 Now show cam2 http://server.com/control/redirect/subscriber?app=src&addr=127.0.0.1 &newname=cam2 The new stream starts immediately in RTMP. In HLS the stream is usually slightly delayed due to the nature of HLS.

Limitations: The feature only works in single-worker mode. You can easily create a streaming backend with a single worker to pull from. MPEG-DASH engine cannot handle stream discontinuities so the feature will not work properly with DASH

© 著作权归作者所有

共有 人打赏支持
MtrS
粉丝 32
博文 583
码字总数 386643
作品 0
榆林
私信 提问
Windows下用FFmpeg+nginx+rtmp搭建直播环境 实现推流、拉流(超简单教程)

成功运行!! 1.环境 开发环境:windows 开发工具:FFmpeg、nginx、nginx-rmtp-module 简介:Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器。 nginx-rmtp...

话不多先森Y
2018/07/20
0
0
Windows使用Nginx搭建RTMP服务器

简介 Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器。 nginx-rmtp-module是Nginx服务器的流媒体插件。 nginx通过rtmp模块提供rtmp服务, ffmpeg推送一个r...

凌浩雨
2018/01/17
0
0
red5 局域网访问问题

setup-Red5-1.0.0-RC1.exe 我用这个的。 一切安好。 本机可以访问http://192.168.0.8:5080 本机flash可以连接rmtp://192.168.0.8/myapp 而换台局域网其他机器,都不可以访问与连接了。 rmtp...

lizhiiii
2014/06/17
1K
4
librtmp 日志的修改和操作 给android打印

最近在做libRtmp(也就是rtmpdump)的工作,发现librtmp默认的日志是关闭的。出现错误了也没法去查找原因。进过一番摸索,终于找了好的解决办法。 首先,找到rtmp控制日志的地方:log.h 和log...

拉风的道长
2016/07/07
137
0
【腾讯bugly干货分享】HTML 5 视频直播一站式扫盲

本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://bugly.qq.com/bbs/forum.php?mod=viewthread&tid=1277 视频直播这么火,再不学就 out 了。 为了紧跟潮流,本文将...

腾讯Bugly
2016/07/04
791
4

没有更多内容

加载失败,请刷新页面

加载更多

centos7 安装maven

进入指定目录 cd /usr/local/src/ 下载maven 包 # 打开这个地址选中自己需要的版本补齐后面的地址,再复制到SSH去执行wget http://mirrors.hust.edu.cn/apache/maven/maven-3/ 解压改名 ...

Elson
32分钟前
4
0
推荐一个开源数据库迁移神器SQLines

SQLines 是一个开源(Apache License 2.0)可伸缩,并发高性能数据传输和schema 转换工具,你可以用作数据库迁移以及ETL过程 支持的数据库: Oracle and Oracle Exadata Microsoft SQL Server...

Benz001
34分钟前
12
0
面试前必知Redis面试题—缓存雪崩+穿透+缓存与数据库双写一致问题

今天来分享一下Redis几道常见的面试题: 如何解决缓存雪崩? 如何解决缓存穿透? 如何保证缓存与数据库双写时一致的问题? 一、缓存雪崩 1.1什么是缓存雪崩? 回顾一下我们为什么要用缓存(Re...

我最喜欢三大框架
34分钟前
3
0
composer 很慢怎么办?

关于 Composer 的详细安装使用,详见之前的文章:在 PHP 中安装、使用 Composer 包管理工具 Composer 在国内不管是更新还是安装等都有一个「慢」的问题,有的时候真的很煎熬。 因此我们一般会...

whoru
47分钟前
2
0
ffmpeg提取音频文件

问题 从特定的mp3音频文件中,提取一部分作为新的mp3文件 ffmpeg ffmpeg -i a.mp3 -ss 00:25:00 -to 00:28:20 -acodec copy b.mp3 -i输入的文件 -ss从指定时间点开始提取 -to到指定时间点结...

亚林瓜子
55分钟前
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部