rtmp { server { listen 1935; application live { allow publish all; allow play all; live on; exec /root/bin/ffmpeg -i rtmp://localhost/live/$name -c:v libx264 -c:a libfdk_aac -b:v 256k -b:a 32k -f flv rtmp://localhost/hls/$name_low -c:v libx264 -c:a libfdk_aac -b:v 768k -b:a 96k -f flv rtmp://localhost/hls/$name_mid -c:v libx264 -c:a libfdk_aac -b:v 1024k -b:a 128k -f flv rtmp://localhost/hls/$name_hi; } application hls { live on; hls on; hls_path /mnt/hls; hls_fragment 15s; hls_variant _low BANDWIDTH=320000; hls_variant _mid BANDWIDTH=640000; hls_variant _hi BANDWIDTH=960000; } } }
解决办法:
hls_continuous on; //打开HLS连续模式。 在这种模式下,HLS序列号从上次停止的地方开始。 老片段被保存。 默认为关闭。