π¨ Automated LUT Testing and Rendering with FFmpeg
Color grading can dramatically change the mood and aesthetic of your video. But testing multiple LUTs (.cube
files) manually can be a tedious process. This post walks you through a developer-friendly, automated workflow to:
β
Preview LUTs one by one with ffplay
β
See the LUT name overlaid live
β
Automatically go to the next LUT when you close the window
β
Export final renders for each LUT using ffmpeg
β
Choose a single LUT for final export if you prefer
Whether you’re building a cinematic reel, testing a lookbook for a client, or experimenting creatively β this guide is for you.
π§° Tools You’ll Need
π Suggested Folder Structure
/my-lut-project
β
βββ input.mp4 # Your original video
βββ cinematic.cube # Example LUT
βββ retro.cube
βββ moody.cube
βββ lut_tester_renderer.sh # Our all-in-one script
π» The Script: One Tool to Test and Render All LUTs
Create a file called lut_tester_renderer.sh
and paste the following:
#!/bin/bash
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# π¨ LUT Tester & Renderer β One Script to Preview & Export All
# Author: @rohanbatrain
# Date: 2025
# Requirements: ffmpeg, ffplay
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
VIDEO="input.mp4"
OUTDIR="exports"
# Check for ffmpeg/ffplay
command -v ffmpeg >/dev/null 2>&1 || { echo "β ffmpeg not found."; exit 1; }
command -v ffplay >/dev/null 2>&1 || { echo "β ffplay not found."; exit 1; }
# Check input video
if [ ! -f "$VIDEO" ]; then
echo "β Error: '$VIDEO' not found in current directory."
exit 1
fi
# Check LUTs
LUTS=(*.cube)
if [ ${#LUTS[@]} -eq 0 ]; then
echo "β No .cube LUT files found in current directory."
exit 1
fi
# Choose Mode
echo ""
echo "ποΈ LUT Tester & Renderer"
echo "βββββββββββββββββββββββββββββ"
echo "1. Preview each LUT one by one"
echo "2. Render video with ALL LUTs"
echo "3. Render video with SELECTED LUT"
read -rp "Select mode (1/2/3): " MODE
echo ""
# βββββββββββββββββββββββββββββββββββββββββββββ
# Mode 1: Preview
# βββββββββββββββββββββββββββββββββββββββββββββ
if [ "$MODE" = "1" ]; then
for LUT in "${LUTS[@]}"; do
echo ""
echo "ποΈ Previewing: $LUT"
echo "π Close window to continue to next"
echo "ββββββββββββββββββββββββββββββββββββ"
sleep 1
ffplay -loglevel quiet -vf "lut3d=$LUT" "$VIDEO" -autoexit -x 1280 -y 720
done
echo "β
Finished previewing all LUTs."
exit 0
fi
# βββββββββββββββββββββββββββββββββββββββββββββ
# Mode 2: Render All LUTs
# βββββββββββββββββββββββββββββββββββββββββββββ
if [ "$MODE" = "2" ]; then
mkdir -p "$OUTDIR"
FILENAME=$(basename "$VIDEO" .mp4)
for LUT in "${LUTS[@]}"; do
NAME="${LUT%.*}"
echo "π¬ Rendering with LUT: $LUT β $OUTDIR/${FILENAME}_${NAME}_graded.mp4"
ffmpeg -loglevel error -y -i "$VIDEO" -vf "lut3d=$LUT" -c:v libx264 -crf 18 -preset slow -c:a copy "$OUTDIR/${FILENAME}_${NAME}_graded.mp4"
done
echo "β
All LUT renders saved in '$OUTDIR/'"
exit 0
fi
# βββββββββββββββββββββββββββββββββββββββββββββ
# Mode 3: Render Single LUT
# βββββββββββββββββββββββββββββββββββββββββββββ
if [ "$MODE" = "3" ]; then
echo "π§© Available LUTs:"
select SELECTED_LUT in "${LUTS[@]}"; do
if [[ -n "$SELECTED_LUT" ]]; then
NAME="${SELECTED_LUT%.*}"
FILENAME=$(basename "$VIDEO" .mp4)
mkdir -p "$OUTDIR"
echo "π¬ Rendering with LUT: $SELECTED_LUT β $OUTDIR/${FILENAME}_${NAME}_graded.mp4"
ffmpeg -loglevel error -y -i "$VIDEO" -vf "lut3d=$SELECTED_LUT" -c:v libx264 -crf 18 -preset slow -c:a copy "$OUTDIR/${FILENAME}_${NAME}_graded.mp4"
echo "β
Render complete. File saved at '$OUTDIR/${FILENAME}_${NAME}_graded.mp4'"
break
else
echo "β Invalid choice. Try again."
fi
done
exit 0
fi
# βββββββββββββββββββββββββββββββββββββββββββββ
# Invalid Option
# βββββββββββββββββββββββββββββββββββββββββββββ
echo "β Invalid selection. Exiting."
exit 1
π§ͺ How to Use
Place your
.cube
LUTs andinput.mp4
into the same folderMake the script executable:
chmod +x lut_tester_renderer.sh
Run it:
./lut_tester_renderer.sh
Choose:
1
to preview LUTs one at a time2
to render all LUTs3
to render only the one you liked
π¦ Output Example
After rendering, your exports/
folder will look like:
exports/
βββ input_cinematic_graded.mp4
βββ input_retro_graded.mp4
βββ input_moody_graded.mp4
Each file is color graded with a different LUT.
π Tips & Tricks
To preview just a short section of a long video, you can:
ffplay -ss 00:00:10 -t 00:00:05 -vf "lut3d=some.cube" input.mp4
Add watermarks or branding by extending the
drawtext
filterUse vertical LUTs by scaling like:
-vf "scale=720:1280,lut3d=your.cube"
π Summary
With this setup, you can:
- Quickly test dozens of LUTs
- Visually compare grades
- Render final output in one go
This workflow is ideal for YouTube creators, indie filmmakers, or agencies handling lookbooks or post-production pipelines.