2026-07-034 min readconvert hls to mp4 ffmpeg, ffmpeg hls to mp4, ffmpeg hls convert

Convert HLS to MP4 Using FFmpeg

Convert HLS streaming video to MP4 with FFmpeg. Fast lossless conversion and re-encoding options for maximum compatibility.

The Standard Command

To convert an HLS stream to MP4 with FFmpeg:

ffmpeg -i "https://example.com/stream.m3u8" -c copy -bsf:a aac_adtstoasc output.mp4

This is the most common command for HLS to MP4 conversion. It preserves original quality by using stream copy mode.

When Stream Copy Fails

If you get errors with -c copy, the stream may use a codec incompatible with MP4. Try re-encoding:

ffmpeg -i "https://example.com/stream.m3u8" -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 128k -pix_fmt yuv420p output.mp4

Hardware Acceleration

For faster conversion on modern hardware:

# NVIDIA NVENC
ffmpeg -i "stream.m3u8" -c:v h264_nvenc -preset p7 -cq 23 -c:a aac output.mp4

# Intel QuickSync
ffmpeg -i "stream.m3u8" -c:v h264_qsv -global_quality 23 -c:a aac output.mp4

# Apple VideoToolbox
ffmpeg -i "stream.m3u8" -c:v h264_videotoolbox -q:v 60 -c:a aac output.mp4

Related Articles