Início / Conhecimento / Ao vivo

Record an HLS Live Stream: Turn Live into Replayable

Este artigo está disponível em chinês e inglês; a tradução para português está a caminho.

A live stream never finishes, so "downloading the whole thing" makes no sense. Recording means continuously pulling segments during the window you want and saving them.

Record with ffmpeg

ffmpeg -i live.m3u8 -c copy -t 600 output.mp4 records for 600 seconds and stops. The -t flag is essential — without it the process runs forever.

Scheduling and looping

Combine cron / Task Scheduler or a script to record a fixed window every day. Let ffmpeg exit cleanly when stopping so the output file gets a complete index.

Things to watch

Recording live content may involve copyright and platform terms — make sure you have the right to save it. Also, the live playlist slides, so playback starts from whatever segments are currently available; anything you missed can't be recovered.
← HLS vs DASH: Two Adaptive Streaming Protocols ComparedM3U8 Playback Troubleshooting Checklist →