NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX: NGINX


rtmp {
    server {
        listen 1935;
        application live {
            live on;
    		record all;
    		record_unique on;
    		record_path "C:/laragon/bin/nginx/nginx-rtmp/video";
    		record_suffix -%Y-%m-%d-%H_%M_%S.flv;
    		# on_publish http://127.0.0.1:8686/auth;
    		# on_play http://127.0.0.1:8686/auth;
        }
    	
        application hls {
            live on;
            hls on;  
            hls_path "C:/laragon/bin/nginx/nginx-rtmp/hls/"; hls_fragment 8s; }}}Copy the code

Here is mainly divided into two parts, one is live push flow, one is HLS push flow.

application live {
    live on;
	record all;
	record_unique on;
	record_path "C:/laragon/bin/nginx/nginx-rtmp/video";
	record_suffix -%Y-%m-%d-%H_%M_%S.flv;
	# on_publish http://127.0.0.1:8686/auth;
	# on_play http://127.0.0.1:8686/auth;
}
Copy the code

Record all data

	record all;

Copy the code

Record value unique

	record_unique on;

Copy the code

Video cache path

	record_path "C:/laragon/bin/nginx/nginx-rtmp/video";

Copy the code

Cache file suffix

	record_suffix -%Y-%m-%d-%H_%M_%S.flv;


Copy the code

Using OBS to push the flow, the configuration is as follows

Click start stream and the result is as follows

Video Stream-1585622145-2020-03-31-10_35_45. FLV: stream-1585622145-2020-03-31-10_35_45Copy the code

HLS configuration

application hls {
    live on;
    hls on;  
    hls_path "C:/laragon/bin/nginx/nginx-rtmp/hls/";
    hls_fragment 8s;  
}

Copy the code

Video Save Path

    hls_path "C:/laragon/bin/nginx/nginx-rtmp/hls/";

Copy the code

The size of each video, the length of each video, is saved here in 8 seconds

    hls_fragment 8s;  

Copy the code

The OBS configuration is as follows

The results are as follows

The push stream of HLS produces an index of M3U8, which holds the index of TS files, as well as video clips. Back end according to the file cache address, can get playback again.