← Blog.backToBlog

Convert HLS to MP4 Using FFmpeg

6 min read

The Standard Command

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

This is the most common HLS→MP4 remux: fast and lossless when codecs already fit MP4. Conceptual guide: convert HLS to MP4.

When Stream Copy Fails

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

Use re-encode for incompatible codecs or when you need maximum device compatibility.

Hardware Acceleration

# NVIDIA
ffmpeg -i "stream.m3u8" -c:v h264_nvenc -preset p7 -cq 23 -c:a aac output.mp4
# Intel Quick Sync
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

Hardware paths are faster for re-encode but quality/settings differ by vendor.

Remux vs Re-encode

Prefer remux (-c copy) for speed and quality. Re-encode only when required. Details: high-quality conversion and complete FFmpeg guide.

No Terminal Option

Our browser converter runs FFmpeg via WebAssembly with no install and no upload.

Frequently Asked Questions

What FFmpeg command converts HLS to MP4?
ffmpeg -i url.m3u8 -c copy -bsf:a aac_adtstoasc out.mp4

Is it lossless?
Yes with -c copy.

When should I re-encode?
When codecs are incompatible or you need a specific profile.

Can I use GPU acceleration?
Yes — NVENC, QSV, or VideoToolbox depending on hardware.