nginx-rtmp-module icon indicating copy to clipboard operation
nginx-rtmp-module copied to clipboard

Helps generating multi bitrate HLS from rtmp stream using ffmpeg syntax

Open thusinh1969 opened this issue 3 years ago • 0 comments

Can someone please help how to receive rtmp as examples but then save into multi bitrate and accessible as VOD afterward ?

ffmpeg -re -i rtmp://localhost:1935/$app/$name -filter_complex '[0:v]split=3[v1][v2][v3]; [v1]copy[v1out]; [v2]scale=w=1280:h=720[v2out]; [v3]scale=w=640:h=360[v3out]' -preset veryfast -g 25 -sc_threshold 0 -map [v1out] -c:v:0 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -b:v:0 5M -maxrate:v:0 5M -minrate:v:0 5M -bufsize:v:0 10M -preset slow -g 48 -sc_threshold 0 -keyint_min 48 -map [v2out] -c:v:1 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -b:v:1 3M -maxrate:v:1 3M -minrate:v:1 3M -bufsize:v:1 3M -preset slow -g 48 -sc_threshold 0 -keyint_min 48 -map [v3out] -c:v:2 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -b:v:2 1M -maxrate:v:2 1M -minrate:v:2 1M -bufsize:v:2 1M -preset slow -g 48 -map a:0 -c:a:0 aac -b:a:0 96k -ac 2 -map a:0 -c:a:1 aac -b:a:1 128k -ac 2 -map a:0 -c:a:2 aac -b:a:2 48k -ac 2 -hls_time 4 -hls_flags independent_segments -use_localtime_mkdir 1 -hls_list_size 10 -hls_playlist_type vod -hls_segment_type fmp4 -hls_base_url http://localhost/recording/test -master_pl_name $name.m3u8 -hls_segment_filename /html/recording/test/$name_%v/s%06d.ts -var_stream_map 'v:0,a:0 v:1,a:1 v:2,a:2' /html/recording/test/$name_%v.m3u8

The above syntax created all files required but inside test_0.m3u8 for example, the link to segments is NOT accessible from Nginx of course. The "/HTML" is the root directory of Nginx. I found no way to specify an absolute path for saving segments/files that can then be accessible via Nginx!

Any hint, please.

Thanks, Steve

thusinh1969 avatar Dec 10 '21 10:12 thusinh1969