Why HLS playlist file & last segment get empty after kill the FFMPEG process which transcode a live stream (NGINX_RTMP)?

  Kiến thức lập trình

FFPMEG command:

ffmpeg -i rtmp://localhost:1940/live/xyz -c:v libx264 -preset veryfast -b:v 400k -c:a aac -b:a 64k -s 426x240 -f hls  -hls_time 5 -hls_list_size 0 -hls_flags delete_segments -hls_segment_filename jack/240p_%03d.ts  jack/240p.m3u8

Actually I am using nginx-rtmp for live stream. And I had a problem that when I finish the live stream my ffmpeg command still waiting for frames , it’s not terminated (even after use -timeout). so I decided to kill that ffmpeg process after live stream finish.And a problem arise here because when i kill that process the HLS playlist(.m3u8) get empty which had contain before terminate & the last HLS segment (.ts) which are not completed the desire segment length , appear in the directory but empty.

Please help me to find out why it’s happen & how can I do that correctly or is there a better strategy for that?

Thank you in advance.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT