Open ToniHawk opened 7 years ago
Why you want to do this! HLS is something diffrent than RTMP and if you want to do something on your video after live... you can use FFMPEG and save the MP4 version of your video (it can be your VOD version)
Hi Massoud, Thank You for the answer. What I realy want to do is a HLS relay Server. I have a remote playlist, wich give me one active link at a time. If I pull two links simultaneously, the first link I've been seeing would stop and the last pulled link, start to reproduce. So I need to multiplex the now playing link to multiple clients in my home network. The solution I found for now, is to use FFMPEG to copy the source link to my HLS path, and then access it with the multiple clients. But my trouble resides when I want to switch the link. In this situation I need a way to pull another source link to copy it to the HLS path. Is there a way to do this?
Hi ToniHawk,
If I understand what you are looking for you should be able to do this through regular nginx. The config I use is:
I create a ramdisk via:
mkdir -p /ramcache/tmp
mount -t tmpfs -o size=2048M tmpfs /ramcache
and then my nginx config is as follows:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 80;
server_name localhost;
location / {
root /ramcache;
try_files $request_uri @proxy_origin;
}
location ~* \.(m3u8)$ {
proxy_cache off; # Do not activate proxy cache (i.e m3u8,f4m,... playlist files)
expires -1; # Cache-Control: no-cache
proxy_pass http://URL OF REMOTE HLS;
}
location ~* \.(ts|trp)$ {
root /ramcache;
try_files $request_uri @proxy_origin;
}
location @proxy_origin {
resolver 8.8.8.8;
proxy_pass http://URL OF REMOTE HLS;
proxy_temp_path "/ramcache/tmp";
proxy_store "/ramcache/$request_uri";
proxy_store_access user:rw group:rw all:r;
proxy_method GET;
proxy_set_header Host $host;
}
}}
Basically what this is doing is having Nginx act as a reverse proxy for the remote hls resources and caches them to disk for future requests. Also just a note, I found this from: https://groups.google.com/forum/embed/#%21topic/nginx-rtmp/rx_54CBKv8Y
Thanks, Ben
Hi You're welcome. If you want to pass HLS requests to another one use the above config then :)
Now its not possible to pull some stream over HLS like it is available with RTMP, using a name. I'm a newbie with nginx, but I consider this software amazing. Is this feature in your roadmap?
Many thanks, and congratulations for this project.