[FFmpeg-user] ffmpeg for transcoding/stream into web pag
kumowoon1025 at gmail.com
Mon May 13 08:03:46 EEST 2019
> I am using: ffmpeg -i "rtsp://192.168.x.y:554/user=admin_password=XXXXXXXX_channel=1_stream=0.sdp?real_stream" -y -c:a aac -b:a 160000 -ac 2 -s 960x540 -c:v libx264 -b:v 800000 -hls_time 10 -hls_list_size 10 -start_number 1 mystream.m3u8
> ffmpeg creates a new file "mystreamnn.ts" every so much time, can the old files be deleted automatically, or can it "wrap around" and start from the start of the file again after a certain amount of time?
You set the maximum number of entries in the playlist to 10, so if you add -hls_flags delete_segments by default it should only keep 10 + 1 segments before deleting them.
> mystream.m3u8 is created after "mystream1.ts" is created/finished, can it be created as soon as ffmpeg starts, so the stream is "immediately" available?
Well this is partly because HLS isn’t really a streaming protocol, I can’t think of any good way to avoid that initial delay. The recommended target duration of each segment is 6 seconds (or adjusted for drop frame) so if you change hls_time from 10 to 6 you could make it shorter but I don’t think that’s usually the “bottleneck,” so to speak. There’s the time needed to connect to the original rtsp source and transcode, for instance.
If you keep an instance running constantly, this would be a non-issue though?
More information about the ffmpeg-user