FFmpeg command generator for HLS, MP4 and thumbnails

FFmpeg Command
Generator.

Build the ffmpeg line without re-reading the docs

Packaging a VOD library usually means the same handful of commands, typed from memory and then fixed by trial and error. Pick a task, fill in the fields, and copy a command that already has the parts people forget: aligned keyframes for ABR switching, +faststart on MP4 output, H.265 tagged as hvc1 so Safari plays it, and a master playlist that matches the renditions you actually encoded.

Everything is generated in your browser. No file is uploaded, nothing is sent to a server, and the page keeps working once it's loaded. The numbers behind the ABR ladder come from Apple's HLS Authoring Specification; edit every field if your encoder doesn't agree.


Command builder

Start from a preset, then adjust. Presets only change the fields; the command is rebuilt every time you touch anything.


The flags worth remembering

Most of these commands differ in a few arguments, and those arguments decide whether playback works. This is what the builder writes for you, and why.

Flag What it does
-g 60 -keyint_min 60 -sc_threshold 0 Forces an IDR every two seconds (60 frames at 30 fps) and turns off scene-cut detection, so every rendition places keyframes on the same boundaries. Without this, ABR switches land mid-GOP and players show a stutter or a black frame.
-hls_time 6 Target segment length. Apple's authoring spec asks for 6 seconds, and never more than 0.5s over the target.
-hls_playlist_type vod Writes #EXT-X-PLAYLIST-TYPE:VOD and closes the playlist with #EXT-X-ENDLIST. Without it, players treat the stream as live and never stop seeking.
-hls_flags independent_segments Adds #EXT-X-INDEPENDENT-SEGMENTS, telling the player every segment starts at a keyframe and can be decoded on its own.
-movflags +faststart Rewrites the MP4 so moov sits before mdat. Progressive download can then start playing before the whole file arrives. MP4 output only, and it needs a second pass over the file.
-tag:v hvc1 Tags HEVC in MP4 as hvc1 instead of hev1. Safari and QuickTime look for hvc1; with hev1 the file plays in Chrome but silently fails on Apple platforms.
-pix_fmt yuv420p The only chroma format every browser decodes. Some sources make encoders pick yuv444p, which then plays nowhere.
-vf "scale=1920:-2" Scales to width 1920 and lets ffmpeg pick the height. -2 rounds to an even number, which H.264 and HEVC require.
-profile:v high -level 4.0 Declares the H.264 profile and level in the bitstream. Set the level too low and hardware decoders reject the file; leave it unset and you get whatever the encoder picks.
-f hls Selects the HLS muxer, which writes the .m3u8 playlist and the segments instead of one flat file.

Two mistakes that cost the most time

Keyframes that don't line up. Each rendition is encoded in its own ffmpeg run, so the segment grid comes from the segment length and the keyframe interval, not from the source. If one command uses -g 60 and another leaves the encoder default, the playlists point at segments that start at different timestamps. Switching looks broken even though every file is valid on its own. Keep the interval identical across renditions and derive it from the frame rate: two seconds means -g equal to twice the fps.

Opus inside MPEG-TS. Opus is not a valid codec inside MPEG-TS segments. If you want Opus audio, encode fMP4/CMAF segments (-hls_segment_type fmp4) and let the master playlist advertise opus in CODECS. The builder warns you when you get the combination wrong.

CRF, and where to start

So what number do you type? CRF is a quality target, not a bitrate: lower means better and bigger. For H.264 the useful range is roughly 18 to 23, and 21 is a safe default for most content. H.265 lands in a similar range, around 20 to 28, because it reaches the same quality at a lower bitrate. AV1 goes higher still, with 30 to 38 typical for SVT-AV1. Change one number, look at the file, and adjust. That beats copying a bitrate from a table tuned for someone else's footage.

Rather not run the encode yourself?

Bradmax takes the master file, builds the ladder, packages HLS and DASH, and serves it from a CDN with per-title encoding. You keep the source; we handle the ffmpeg.

See what the platform does: Video analytics and VOD delivery.

Check the output before you ship it

Validate the playlist with the HLS playlist inspector, confirm the MP4 starts fast with the MP4 faststart checker, and size the egress with the video bandwidth calculator.