C.W.K.
Stream
Lesson 03 of 08 · published

Benchmarking

~10 min · benchmark, vmaf, psnr, quality

Level 0Viewer
0 XP0/73 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

속도와 quality 둘 다 중요

'빠른' 인데 안 좋아 보이는 encode 는 쓸모없어. 30× real time 걸리는 'high quality' 인데 일상 작업 안 됨도 쓸모없어. Right 답이 속도 × quality 의 Pareto frontier 위, 찾는 법은 측정.

측정 셋

  • Wall-clock encode timetime ffmpeg .... Source duration 에 비교; ratio 가 'realtime multiplier'.
  • 파일 사이즈ls -lh. 다른 preset/CRF/encoder 의 같은 source.
  • VMAF — Netflix 의 perceptual quality score (0–100). 95+ ≈ visually lossless. libvmaf filter 가 encoded output 을 source 와 비교.

Code

Time + size + VMAF score·bash
# Encode
time ffmpeg -y -i src.mp4 \
  -c:v libx264 -crf 22 -preset slow -c:a copy \
  test.mp4

ls -lh test.mp4

# VMAF score (libvmaf 컴파일 필요 — Homebrew default 가 가짐)
ffmpeg -i test.mp4 -i src.mp4 -lavfi libvmaf=log_path=vmaf.json:log_fmt=json \
  -f null -

# 결과 읽어:
jq '.pooled_metrics.vmaf' vmaf.json
# 96.5 = visually lossless
# 90+ = excellent
# 80+ = 일상 사용에 좋음
# 70 미만 = 보이는 압축
Sweep — Pareto frontier 찾기·bash
# libx264 의 CRF sweep + time/size/vmaf dump
for crf in 18 20 22 24 26 28; do
  start=$(date +%s)
  ffmpeg -y -i src.mp4 -c:v libx264 -crf $crf -preset slow -c:a copy \
    test_${crf}.mp4 >/dev/null 2>&1
  end=$(date +%s)
  size=$(ls -l test_${crf}.mp4 | awk '{print $5}')
  ffmpeg -i test_${crf}.mp4 -i src.mp4 -lavfi libvmaf=log_path=vmaf_${crf}.json:log_fmt=json \
    -f null - 2>/dev/null
  vmaf=$(jq -r '.pooled_metrics.vmaf' vmaf_${crf}.json)
  printf 'crf=%d  %ds  %dMB  vmaf=%.2f\n' $crf $((end-start)) $((size/1024/1024)) $vmaf
done

External links

Exercise

Source clip 하나 픽. 위 CRF sweep 을 libx264 -preset slow 에 돌려. CRF 를 x-axis, 파일 사이즈 한 y-axis, VMAF 다른 y-axis 에 plot. 사이즈/quality curve 의 'knee' (VMAF 가 빠르게 떨어지기 시작하는 곳) 가 sweet spot. Script 저장 — 어떤 새 콘텐츠 type 에든 CRF 픽하는 right way.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.