Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTMP Pull and hls #1404

Open
mekk55 opened this issue Apr 17, 2019 · 4 comments
Open

RTMP Pull and hls #1404

mekk55 opened this issue Apr 17, 2019 · 4 comments

Comments

@mekk55
Copy link

mekk55 commented Apr 17, 2019

I've just started using Nginx with rtmp module. I set up nginx.conf to "pull" from exsiting rtmp link

 application stream {
            live on;
            pull rtmp://111.222.333.444:1937/origin_appname live=1;

            hls on;
            hls_nested on;
            hls_path /mnt/hls/stream/;
            hls_fragment 3s;
            hls_playlist_length 10;
            hls_type event;

        }

Then I config for hls to alias /mnt/hls/stream/ now I can open RTMP but I'm not understand that why If I'm not open RTMP parallel with HLS there is no playlist created in /mnt/hls/stream/ it's mean that If I call only HLS Nginx will return "not found" and I checked that there is no playlist file in path.

What's mistake of configuration ?
How can I config Nginx to create playlist when call only HLS ?

Another question is I configed "secure_link" and "secure_link_md5" to HLS and now it's work for protect playlist.m3u8 but playlist didn't include secure_link after .ts so Nginx return "forbiden" for .ts inside playlist.m3u8.

How can I fix this problem ?

location /test {
        
            add_header Cache-Control no-cache;

            secure_link $arg_md5,$arg_expires;
            secure_link_md5 "$secure_link_expires$uri$remote_addr PASSWORD";

            if ($secure_link = "") { return 403; }
            if ($secure_link = "0") { return 410; }
            
            types {
            application/vnd.apple.mpegurl m3u8;
            video/mp2t ts;
            plain/text key;
            }
            alias /mnt/hls/stream/;

        }
@Lax
Copy link

Lax commented Apr 18, 2019

pull is only triggered when a client is connected and playing the stream.
When there's no active rtmp client, the stream just terminated, so there no content to save to hls folder.
you can run a exec_static ffmpeg ... to pull the stream automatically

@mekk55
Copy link
Author

mekk55 commented Apr 18, 2019

exec_static ffmpeg

pull is only triggered when a client is connected and playing the stream.
When there's no active rtmp client, the stream just terminated, so there no content to save to hls folder.
you can run a exec_static ffmpeg ... to pull the stream automatically

Can I wildcard exec_static ffmpeg pull like normal "pull" command ?

@Lax
Copy link

Lax commented Apr 18, 2019

Can I wildcard exec_static ffmpeg pull like normal "pull" command ?

no

@ajitabhpandey
Copy link

Another question is I configed "secure_link" and "secure_link_md5" to HLS and now it's work for protect playlist.m3u8 but playlist didn't include secure_link after .ts so Nginx return "forbiden" for .ts inside playlist.m3u8.

How can I fix this problem ?

I had the same problem myself, which I raised in the StackOverFlow forum a little while ago. But I found the answer myself.
Please see this answer with code snippet - https://stackoverflow.com/a/59241113/1213682

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants