This is an example of how to record a live HLS stream to a file for a specific time period. Useful for DVR like functions of live adapative streams (noting that at the time of writing multi-rate adapative for ffmpeg isn’t great). I have selected ts as the output as this is the minimum overheard though you could easily go to MP4 of equivalent.
This records the live stream to a file for 30 seconds:
ffmpeg -re -i http://yourserver.com/live/stream1/playlist.m3u8 -ss 00:00:00.0 -t 00:00:30.0 -c:v copy -c:a copy test_record.ts -y