Tool

Representative Test Clips for VMAF and CRF Tests

Encoding a two-hour video in full for every CRF value you want to compare can take a whole day. Enter the video duration and this tool picks a few short segments spread evenly across it, avoiding the start and end, and builds the ffmpeg commands that cut out just those segments. Calculations happen only inside this browser, and no video file is read.

Cut method

Enter the duration from ffprobe output (optional)

Selected clips (video duration 1:32:40.000)

#StartEndPosition
118:27.00018:37.00019.9%
246:15.00046:25.00049.9%
31:14:03.0001:14:13.00079.9%

① Clip extraction commands (run one line at a time)

ffmpeg -ss 1107.000 -i "input.mp4" -t 10 -an -c:v libx264 -qp 0 -preset veryfast -pix_fmt yuv420p "input_clip01.mkv"
ffmpeg -ss 2775.000 -i "input.mp4" -t 10 -an -c:v libx264 -qp 0 -preset veryfast -pix_fmt yuv420p "input_clip02.mkv"
ffmpeg -ss 4443.000 -i "input.mp4" -t 10 -an -c:v libx264 -qp 0 -preset veryfast -pix_fmt yuv420p "input_clip03.mkv"

② Joining the clips into one file: contents of list.txt

file 'input_clip01.mkv'
file 'input_clip02.mkv'
file 'input_clip03.mkv'

③ Concatenation command

ffmpeg -f concat -safe 0 -i list.txt -c copy "input_testset.mkv"

Check the duration (ffprobe)

ffprobe -v error -show_entries format=duration -of default=nw=1 "input.mp4"

Check keyframe times in the first 60 seconds (ffprobe)

ffprobe -v error -select_streams v:0 -show_entries packet=pts_time,flags -of csv=p=0 -read_intervals "0%+60" "input.mp4"

What this tool does

It takes the target range (the video duration minus the fraction you skip at the start and end), divides it into as many equal bins as the number of clips, and places a clip of the length you set at the center of each bin. That is all. It does not choose by scene content, so ‘representative’ here only means evenly spread out; it does not guarantee that the clips' scores match the average of the whole video.

How to use it

  1. Read the video duration with the ffprobe command at the bottom of the tool and enter it (you can also paste the output).
  2. Choose the number and length of the clips. The measurements on this site used 10-second clips, so the default is 10 seconds. How many are enough depends on the video; see ‘Limitations’ below.
  3. ‘Exact cut’ gives a start time exactly where you asked, and produces an MKV re-encoded once with lossless (-qp 0) H.264. That is safe to use as a test source, but the files are large. For how many times larger near-lossless files get, see the result tables in the lossless archiving measurement.
  4. ‘Copy as is’ finishes almost instantly with no re-encoding, but it can only start at a keyframe, so the real start is known to land earlier than requested. Estimate the drift with the Lossless Cut Keyframe Planner, and verify the result with ffprobe.
  5. Encode each extracted clip with the same CRF candidates, then measure per-clip scores with the VMAF command builder. If the per-clip scores differ a lot, that is a sign the video's quality varies a great deal from scene to scene.
  6. After narrowing down the candidates, it is safer to do one final check on the full video. If you are still at the stage of choosing first candidates, you can start from the measured values in the CRF recommender.

About joining the clips

Commands ② and ③ are optional, for when you want to join the clips into one file and test it in one pass. In a joined file the scene changes abruptly between clips, so the encoder's motion prediction starts fresh at each of those points. If you don't want the seams between clips to affect the result, encoding each clip separately is simpler. Only pieces with the same codec, resolution and frame rate can be joined with -c copy, and you can check compatibility with the Concat Compatibility Checker.

Limitations

  • We have not measured how many clips are enough to represent the whole video. ‘How many points does the average of 3 clips differ from the whole video’ is a question this site has not measured yet, so no number is given. The reasonable inference is that a monotonous video gives similar results with few clips, while a video with varied scenes can score differently in the parts the clips missed. How CRF results vary by content can be seen with 4 clips in the CRF by content measurement.
  • Clips are chosen by time spacing only; the tool does not find scene changes, dark scenes or fast motion. If a specific scene worries you, find its timestamp yourself and cut it out as a separate clip.
  • The keyframe interval input assumes a constant interval. It may not hold for encodes that add keyframes at scene changes.
  • Putting -ss before the input is fast, but depending on the video format the start frame may be off by a few frames. That is usually fine for testing, but if you need frame-exact matching, verify with ffprobe.
  • Audio is assumed not to be part of the test and is dropped with -an. If you need audio, remove -an from the command and add -c:a copy.
  • Using the ‘Exact cut’ command as is on a 10-bit or HDR source converts it to 8-bit 4:2:0 (-pix_fmt yuv420p). If that property is part of what you are testing, use ‘Copy as is’ or change the pixel format in the command yourself.
  • The tool only builds the commands and never runs them, and it does not read your files or send anything to a server.