A maximum-compatibility MP4 for embedding on web pages: Baseline profile at level 3.1 decodes on almost any device, mono AAC at 44.1 kHz keeps the audio small, and loudnorm evens out the volume between clips.

Also in notes/ffmpeg-filters.txt: this exact command inside a loop. For a same-size encode, see web-mp4-baseline-keep-size.sh.

The command

ffmpeg -i input.mp4 \
  -vf "scale=600:600,format=yuv420p" \
  -af loudnorm \
  -c:v libx264 -crf 20 -profile:v baseline -level:v 3.1 \
  -c:a aac -b:a 128k -ac 1 -ar 44100 \
  -movflags +faststart \
  output.mp4

What each part does

-vf "scale=600:600,format=yuv420p"
                       resize to exactly 600×600 (this stretches non-square
                       sources; see resize-crop/ to crop instead) and use
                       4:2:0 chroma, which every player supports
-af loudnorm           EBU R128 loudness normalization (single pass)
-c:v libx264 -crf 20   H.264 at constant quality 20 (lower = better)
-profile:v baseline -level:v 3.1
                       widest decoder support, no B-frames
-c:a aac -b:a 128k -ac 1 -ar 44100
                       AAC, 128 kb/s, mono, 44.1 kHz
-movflags +faststart   playback can start before the download finishes

When to use it

Use this when you need a small square clip that plays almost anywhere, such as an embedded preview, a thumbnail video or a social-style tile. It favours compatibility and consistent volume over quality. The header explains each flag.

Don't use it for non-square footage you care about. scale=600:600 stretches the picture instead of cropping it, so crop first with one of the scripts in the resize-crop/ theme, or keep the original dimensions with web-mp4-baseline-keep-size.sh.

Useful variations:

  • Change both 600 values for a different square size.
  • Lower -crf 20 for better quality and bigger files, or raise it for smaller ones.
  • Change -ac 1 to -ac 2 to keep stereo.

If the output looks wrong:

  • Squashed or stretched picture: the source wasn't square.
  • Volume differs from the original: this is loudnorm working as intended, and it is a single pass.
  • Playback waits for the full download: check that -movflags +faststart survived your edits.

Notes

Source
ffmpeg-utilities/ogg-mp4-jpg-600.sh (also vector copy.sh, vector copy 2.sh)
Changed
-filter:a → -af; -level → -level:v