hi i am restreaming an hls stream as a hls stream
SETLOCAL
:loop
ffmpeg -thread_queue_size 32768 -i "http://xx/636.m3u8" -f hls -hls_time 5 -hls_list_size 5 -hls_allow_cache 0 -hls_flags delete_segments -segment_list_flags +live -hls_base_url "../ts/" -hls_segment_filename "C:\nginx\html\ts\lig-%random%%random%-%%3d.svgz" -y "C:\nginx\html\hls\lig1.m3u8" > log.txt
goto loop
but it uses %15-20 of cpu i have to make 16 streams like that in same server but i can't.
cant i make a configuration like just downloading .ts files cloning the m3u8?
By default, FFmpeg will try to reencode the input, even if you don't use any encoding related parameters.
If you want to just copy the stream as is, you should try the streamcopy function:
-c:v copy -c:a copy
By copying the incoming streams, you can skip the encoding process entirely.
So your command would look like this:
ffmpeg -thread_queue_size 32768 -i "http://xx/636.m3u8" -f hls -c:v copy -c:a copy -hls_time 5 -hls_list_size 5 -hls_allow_cache 0 -hls_flags delete_segments -segment_list_flags +live -hls_base_url "../ts/" -hls_segment_filename "C:\nginx\html\ts\lig-%random%%random%-%%3d.svgz" -y "C:\nginx\html\hls\lig1.m3u8" > log.txt
(Not sure if it'll work, though.)
When you need to re-encode the incoming stream, you should consider to add some encoding parameters to the command.
By default, ffmpeg tries to match the source parameters and quality, which not always the most optimal in live applications.
The "veryfast, superfast and ultrafast" h264 presets is a good start to get some performance boost.
-c:v h264 -preset:v ultrafast
You can also fiddle with CRF (Constant Rate Factor) encoding, higher bitrates, etc.
More about H264 enoding: https://trac.ffmpeg.org/wiki/Encode/H.264