The normalize filter maps the darkest pixels to black and the brightest to white over a rolling window of frames, a dynamic auto-levels. With independence=1 each color channel is stretched separately, which also removes color casts (and can shift colors dramatically on flat footage). Use independence=0 to stretch all channels together and keep the hues.
The command
ffmpeg -framerate 29.97 -i frames/f%05d.jpg \
-vf "scale=1280:720:force_original_aspect_ratio=increase,crop=1280:720:(in_w-out_w)/2:(in_h-out_h)/2+200,format=gbrp,normalize=blackpt=black:whitept=white:independence=1" \
-t 10 \
-an \
-c:v libx264 -preset ultrafast -crf 40 -pix_fmt yuv420p \
output.mp4 What each part does
-framerate 29.97 -i frames/f%05d.jpg
read f00001.jpg, f00002.jpg, … at 29.97 fps
scale=1280:720:force_original_aspect_ratio=increase
crop=1280:720:(in_w-out_w)/2:(in_h-out_h)/2+200
fill 1280×720, crop centered horizontally and
200 px below center (ffmpeg clamps the window
to stay inside the frame)
format=gbrp planar RGB, so normalize works per color channel
normalize=blackpt=black:whitept=white:independence=1
-t 10 stop after 10 seconds
-an -c:v libx264 -preset ultrafast -crf 40 -pix_fmt yuv420p
very fast, very rough draft encode for previews
(use -crf 18 for a final render) When to use it
Useful when an image sequence looks flat, washed out or tinted, and you want a quick auto-levels pass while turning it into a 1280×720 preview video. Because normalize works over a rolling window of frames, it adapts as the footage changes. That makes it a poor fit when exposure has already been graded, or when you need levels to stay fixed for the whole clip. The header explains each flag.
Useful variations:
- Set
independence=0to stretch all channels together and keep the original hues. - Change
-framerate 29.97to match how the frames were shot, and change or remove-t 10to render more of the sequence. - Change
+200in the crop to move the window up or down, or set it to+0to center it.
If colors shift dramatically, switch to independence=0. If the output is blocky, that's the -crf 40 draft setting; use -crf 18 for a final render. If ffmpeg finds no input, check that your files match the frames/f%05d.jpg pattern.
Notes
- Source
- ffmpeg-utilities/faces-ffmpeg.sh (the first two commands)
- Changed
- -r 29.97 before -i → -framerate 29.97 (the image2 demuxer's own option); -filter_complex → -vf; -vcodec → -c:v