我有商业流媒体服务器,通过HLS在欧洲流媒体。
http://europe.server/stream1/index.m3u8
现在我在美国的客户由于距离的原因有一些网络问题。
所以我在美国部署了新的服务器。我希望它能接收来自欧洲服务器的HLS流,并响应美国的客户。
这样用户就可以像这样访问
http://usa.server/stream1/index.m3u8
这将是H265/HEVC,所以RTMP是不可能的。我在网上看到的每个教程都是基于RTMP的。
我使用了https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/中的以下配置作为参考。
worker_processes auto;
events {
worker_connections 1024;
}
http {
sendfile off;
tcp_nopush on;
aio on;
directio 512;
default_type application/octet-stream;
server {
listen 8080;
location / {
# Disable cache
add_header 'Cache-Control' 'no-cache';
# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
types {
application/dash+xml mpd;
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /mnt/;
}
}
}发布于 2020-09-22 12:59:17
这比看起来容易得多。
你不需要任何东西,只需要一个缓存代理服务器。所有的视频工作都已经为你完成了。
一个类似下面的Nginx配置文件就可以了:
proxy_cache_path /path/to/cache levels=1:2 keys_zone=my_cache:10m max_size=100g
inactive=10m use_temp_path=off;
server {
location / {
proxy_cache my_cache;
proxy_pass http://europe.example.com;
}
}另请参阅:https://www.nginx.com/blog/nginx-caching-guide/#proxy_cache
此外,我强烈建议使用现有的CDN,这将提高性能并降低您的维护成本。
发布于 2020-09-22 12:48:43
目前还不清楚,问题是什么,但答案是:不,nginx对它没有好处。
在美国你仍然需要视频流媒体服务器,因为如果你想交付dash + hls,你需要在美国将视频重新打包在两个容器中。
Nginx将发送所有流量两次(超过两次),视频流将发送一次。
https://stackoverflow.com/questions/63987108
复制相似问题