Skip to content
C.W.K.
Lesson 05 of 05 · published

Decided by Measurement

~15 min · measurement, hevc, videotoolbox, hdr, defaults

Level 0Closed Lens
0 XP0/45 lessons0/13 achievements
0/100 XP to next level100 XP to go0% complete

A Default Is a Claim

Every default in a recorder is a claim about the hardware it runs on: this many frames a second, this resolution, this bitrate, this colour handling. Most apps take those claims from a spec sheet or from habit. Oriel's architecture document takes them from measurements on the actual Mac, and records each measurement next to the decision it made, with the date and the tool that took it. This lesson walks three of those decisions, because together they show the habit better than any rule could.

1. Why the Camera Role Is 1080p

Oriel records two capture cards at once: one carrying the game console's picture, one carrying Dad's camera. The natural wish is 4K60 on both. Before anything was set, the encoder was measured on the home Mac, an M4 Pro, using the hardware HEVC encoder through VideoToolbox:

LoadMeasuredVerdict
One 4K60 HEVC stream93 fpsfits, with room
Two concurrent 4K60 streams47 fps eachdoes not fit: 60 is needed
4K60 plus 1080p60faster than real timefits

So the defaults are 4K60 at 40 Mbps for the game (about 18 GB an hour) and 1080p60 at 12 Mbps for the camera (about 5.4 GB an hour). The house sign carries the consequence as a one-line rule: keep the camera role at 1080p unless the hardware changes, and re-measure before raising it. Notice what that rule does not say. It does not say "two 4K streams are too much for this chip" as a general truth. It says what was measured, on what, and what to do before changing it.

When both cards then recorded together for seventy seconds, the recorder delivered 59.90 and 59.87 frames a second with a median interval of exactly 16.667 ms, a handful of missing frames and none dropped, at about a fifth of one core. The default was checked again under the load it was chosen for.

2. Why Oriel Has No HDR Code

The game console can output HDR. A capture card that hands an HDR picture to software expecting standard range produces a washed-out, grey frame, and an early test with a different card showed exactly that: the console's home screen topped out well below white with HDR on. Two paths were possible. Either the source reaches the card as standard range (or the card tone-maps it), or Oriel would have to capture the card's 10-bit mode and tone-map before recording and before every look. The second path is real work and a permanent source of colour bugs.

The decision was made by measuring the card Oriel actually uses. Two facts settled it. First, the card offers only 8-bit formats over its USB video interface, every one tagged BT.709, so a 10-bit capture was not even available. Second, the same console screen was read with HDR as found and then with the console's HDR forced always on, fifteen frames each, as raw luma codes:

Console HDRp50p99p99.9max
as found31157203221
always on31157203223

No lift, no wash: the card either tells the console it takes standard range or tone-maps on its own output. For Oriel the result is the same, and the architecture document records the decision in one line: path 1 holds, and Oriel needs no HDR-to-SDR handling. A whole subsystem was never written, because a measurement said it was not needed.

3. What Is on a Card's Sound, Read Without Listening

Each capture card also carries two channels of HDMI audio, and nobody was sure which signal rode which card. Rather than guess from the wiring diagram, a small signed probe opened each card's audio for a bounded time and reported levels and the correlation between the left and right channels. One card showed true stereo (correlation 0.598) with a 5 to 10 dB rise within 100 to 300 ms of each of six D-pad presses: the console's menu click, so this was the game's sound. The other showed one signal duplicated on both channels (correlation 1.000) in speech-shaped bursts: a voice, mono. The report says it plainly: read from levels and timing, not heard by ear.

The Habit Underneath

Three things repeat in all three stories. The question was asked of the real device on the real Mac, not of a datasheet. The answer was written down with its numbers, date and tool, so the next person can rerun it instead of trusting it. And a measurement that disagreed with intuition won. Later in this quest you will meet the same habit from the other side: a failed or missing measurement is said with what it saw and never blocks the work. Knowledge, not a gate.

Code

Measure your own Mac's hardware HEVC headroom: one 4K60 stream, then two at once·bash
# ffmpeg with VideoToolbox (Homebrew's build has it). The 'speed=' it prints
# is frames encoded per second relative to real time: 1.0x at 60 fps means
# exactly keeping up.
src='testsrc2=size=3840x2160:rate=60'

# One stream
ffmpeg -hide_banner -f lavfi -i "$src" -t 20 \
  -c:v hevc_videotoolbox -b:v 40M -f null - 2>&1 | tail -n 2

# Two at once: does each still reach 1.0x?
for n in 1 2; do
  ffmpeg -hide_banner -f lavfi -i "$src" -t 20 \
    -c:v hevc_videotoolbox -b:v 40M -f null - 2>&1 | tail -n 1 &
done
wait
Read luma percentiles from captured frames instead of judging by eye·python
# pip install pillow numpy; pass frame files (PNG or JPEG) as arguments.
import sys

import numpy as np
from PIL import Image

values = []
for path in sys.argv[1:]:
    luma = np.asarray(Image.open(path).convert("L"), dtype=np.uint8)
    values.append(luma.ravel())
all_luma = np.concatenate(values)

for name, q in (("p50", 50), ("p99", 99), ("p99.9", 99.9)):
    print(f"{name:6} {np.percentile(all_luma, q):6.1f}")
print(f"max    {all_luma.max():6d}  (frames: {len(values)})")
# Compare two runs (setting off, setting on). A washed-out HDR frame shows a
# max far below the SDR run's and a compressed upper range.

External links

Exercise

Run the two-stream ffmpeg test from this lesson on your own Mac (or the equivalent hardware encoder on your machine). Record the speed for one stream and for two concurrent streams, then write the default you would choose for a two-camera recorder in one sentence that names the measurement, the date and the machine.
Hint
If one stream shows 1.5x and two show 0.8x each, two 4K60 streams do not fit in real time, whatever the chip's marketing says. The sentence should read like Oriel's house rule: what was measured, on what, and what to do before changing it.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign in — Please sign in to comment.

No comments yet — be the first.