# Automate Pre-Delivery Asset Validation on a Rented Mac

Canonical: https://figment.so/blog/mac-pre-delivery-asset-validation

Save the validation script below, point it at a spec file, and run it on the delivery folder before upload. ffprobe only reads headers, so the Intel Mac VM ($2 a day, $25 a month) is enough for the check.

Run the validation script below on the delivery folder just before upload. It checks every file's codec, resolution, frame rate, pixel format and filename against a spec file and exits non-zero on any mismatch. A render that looks right on screen can still fail broadcast QC because of one wrong codec profile, frame-rate rational or filename character. The script only reads container headers with ffprobe, so a small Mac is enough. Bigger hardware matters only if the same session also transcodes or renders.

## Which delivery failures does this catch?

Broadcast and streaming platforms reject deliverables for a short list of predictable reasons:

- **Codec mismatch:** sending H.264 when the spec demands ProRes 422 HQ, or submitting ProRes 4444 when only ProRes 422 is accepted.
- **Resolution or aspect ratio:** 1920×1090 instead of 1920×1080, or anamorphic pixel dimensions when square pixels are required.
- **Frame-rate rational:** `30/1` (true 30 fps) versus `30000/1001` (29.97). They look identical on a timeline and fail an exact-match spec check.
- **Pixel format and bit depth:** `yuv420p` (8-bit 4:2:0) versus `yuv422p10le` (10-bit 4:2:2). HDR pipelines also need specific transfer-function and colour-primaries metadata.
- **Naming conventions:** a client spec requiring `SHW_S01E03_v2.mov` will bounce `show_S01E03_v2.mov` immediately.

Manual spot-checking of one or two files misses regressions across a batch. The script checks every file in a folder against a machine-readable spec and fails loudly.

## How do I install ffprobe on the rented Mac?

Install Homebrew, then FFmpeg and jq, once per rental. ffprobe ships with every FFmpeg build and reads structured metadata from almost any media container. Run this over SSH or in Terminal through remote desktop:

```bash
# One-time setup on the rented Mac (over SSH or in Terminal through remote desktop)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install ffmpeg   # includes ffprobe
brew install jq       # JSON parser used by the validation script
```

Per the [ffprobe documentation](https://ffmpeg.org/ffprobe.html), `-of json -show_entries` returns only the fields you ask for, and `-select_streams v:0` narrows output to the first video track:

```bash
ffprobe -v quiet -of json \
  -show_entries "stream=codec_name,width,height,r_frame_rate,pix_fmt" \
  -select_streams v:0 \
  deliverable.mov
```

For HDR deliverables, add `color_space,color_transfer,color_primaries` to `-show_entries` to check the EOTF and gamut tags your client requires (for example `bt2020` primaries and `smpte2084` transfer for HDR10).

## How do I cross-check with mdls?

Use `mdls` as a quick second opinion once Spotlight has indexed the files. It prints macOS metadata attributes, and content-type values use Apple's [Uniform Type Identifiers](https://developer.apple.com/documentation/uniformtypeidentifiers):

```bash
mdls -name kMDItemPixelWidth -name kMDItemPixelHeight render_ep03.mov
mdls -name kMDItemContentType render_ep03.mov
# com.apple.quicktime-movie for .mov
# public.mpeg-4 for .mp4
```

`mdls` depends on Spotlight indexing, which may not have run on files you just copied in. Treat ffprobe as the authoritative source for per-stream checks.

## How do I write the spec file?

Encode the client's requirements as a flat key=value file. The `fps` value must match ffprobe's `r_frame_rate` output exactly, because it is a rational and not a decimal. The `naming_re` must be a working extended regex for the real filename pattern.

```ini
# apple_tv_plus_spec.conf
# 4K ProRes 422 HQ, 23.976 fps, 10-bit 4:2:2
codec=prores
width=3840
height=2160
fps=24000/1001
pix_fmt=yuv422p10le
naming_re=^SHW_S[0-9]{2}E[0-9]{2}_v[0-9]+\.mov$
```

Common fps rationals: `24/1` (true 24), `24000/1001` (23.976), `30/1` (true 30), `30000/1001` (29.97), `60/1` (true 60), `60000/1001` (59.94). Run `ffprobe` once on a known-good render from your editing app and copy the string it prints. Some tools write `prores` and some write `prores_ks`, so use whichever your renders produce. Keep each value on a single line with no surrounding spaces. The loader strips whitespace from every value.

## What does the validation script look like?

Save it as `validate_delivery.sh`, run `chmod +x`, and run it against a batch folder. It is an untested example, so test it on a known-good and a known-bad file before a deadline.

```bash
#!/usr/bin/env bash
# validate_delivery.sh — pre-delivery QC for broadcast/streaming deliverables
# Usage: ./validate_delivery.sh <spec.conf> <media_folder>
# Requires: ffprobe (brew install ffmpeg), jq (brew install jq)
set -euo pipefail

SPEC="${1:?Usage: $0 <spec.conf> <media_folder>}"
FOLDER="${2:?Usage: $0 <spec.conf> <media_folder>}"

spec_val() { grep -E "^${1}=" "$SPEC" | cut -d= -f2- | tr -d '[:space:]'; }

EXPECTED_CODEC=$(spec_val codec)
EXPECTED_WIDTH=$(spec_val width)
EXPECTED_HEIGHT=$(spec_val height)
EXPECTED_FPS=$(spec_val fps)
EXPECTED_PIX=$(spec_val pix_fmt)
NAMING_RE=$(spec_val naming_re)

PASS=0; FAIL=0; FAIL_MSGS=()

check_file() {
  local FILE="$1" BASE PROBE CODEC WIDTH HEIGHT R_FPS PIX
  BASE="$(basename "$FILE")"
  local -a ISSUES=()

  if [[ -n "$NAMING_RE" ]] && ! [[ "$BASE" =~ $NAMING_RE ]]; then
    ISSUES+=("naming: does not match /$NAMING_RE/")
  fi

  if ! PROBE=$(ffprobe -v quiet -of json \
      -show_entries "stream=codec_name,width,height,r_frame_rate,pix_fmt" \
      -select_streams v:0 "$FILE" 2>/dev/null); then
    FAIL_MSGS+=("FAIL [unreadable] $BASE")
    FAIL=$((FAIL + 1)); return 0
  fi

  CODEC=$(printf '%s' "$PROBE"  | jq -r '.streams[0].codec_name   // empty')
  WIDTH=$(printf '%s' "$PROBE"  | jq -r '.streams[0].width        // empty')
  HEIGHT=$(printf '%s' "$PROBE" | jq -r '.streams[0].height       // empty')
  R_FPS=$(printf '%s' "$PROBE"  | jq -r '.streams[0].r_frame_rate // empty')
  PIX=$(printf '%s' "$PROBE"    | jq -r '.streams[0].pix_fmt      // empty')

  [[ "$CODEC"  != "$EXPECTED_CODEC"  ]] && ISSUES+=("codec=$CODEC want=$EXPECTED_CODEC")
  [[ "$WIDTH"  != "$EXPECTED_WIDTH"  ]] && ISSUES+=("width=$WIDTH want=$EXPECTED_WIDTH")
  [[ "$HEIGHT" != "$EXPECTED_HEIGHT" ]] && ISSUES+=("height=$HEIGHT want=$EXPECTED_HEIGHT")
  [[ "$R_FPS"  != "$EXPECTED_FPS"    ]] && ISSUES+=("fps=$R_FPS want=$EXPECTED_FPS")
  [[ "$PIX"    != "$EXPECTED_PIX"    ]] && ISSUES+=("pix_fmt=$PIX want=$EXPECTED_PIX")

  if [[ ${#ISSUES[@]} -gt 0 ]]; then
    local MSG
    printf -v MSG '%s, ' "${ISSUES[@]}"
    FAIL_MSGS+=("FAIL $BASE — ${MSG%, }")
    FAIL=$((FAIL + 1))
  else
    printf 'PASS %s\n' "$BASE"
    PASS=$((PASS + 1))
  fi
}

shopt -s nullglob nocaseglob
FILES=()
for G in "$FOLDER"/*.mov "$FOLDER"/*.mp4 "$FOLDER"/*.mxf; do
  FILES+=("$G")
done

if [[ ${#FILES[@]} -eq 0 ]]; then
  printf 'No .mov/.mp4/.mxf files found in %s\n' "$FOLDER"; exit 1
fi

for f in "${FILES[@]}"; do check_file "$f"; done

printf '\n===== QC REPORT =====\nPASS: %d   FAIL: %d\n\n' "$PASS" "$FAIL"

if [[ ${#FAIL_MSGS[@]} -gt 0 ]]; then
  printf '%s\n' "${FAIL_MSGS[@]}"
  exit 1
fi
exit 0
```

Exit code `1` means at least one file failed, so the script slots in front of an upload step or a Shortcuts automation. Exit code `0` means every `.mov`, `.mp4` or `.mxf` in the folder passed every check. `set -euo pipefail` makes a broken ffprobe call or an unset variable stop the run instead of reporting success. For audio checks, call `ffprobe` a second time with `-select_streams a:0` and compare `codec_name`, `sample_rate` and `channels` the same way.

## How do I check HDR and colour space?

Add colour metadata to both the spec file and the ffprobe query:

```bash
# Add to spec.conf
color_space=bt2020nc
color_transfer=smpte2084
color_primaries=bt2020

# Then add to -show_entries in check_file():
# stream=codec_name,width,height,r_frame_rate,pix_fmt,color_space,color_transfer,color_primaries
# And compare the three new variables the same way.
```

Container tags prove the file carries the right metadata, which is what most automated QC tools reject on. They are not a colour-accurate preview and do not replace a calibrated hardware monitor at sign-off.

## What should I check right before upload?

Run this on the rented Mac in the minute before you upload:

1. `ffprobe` the first and last file in the batch by hand and confirm the output before you trust the script on the rest.
2. Run `./validate_delivery.sh spec.conf out/` and confirm `FAIL: 0`.
3. Spot-check one file with `mdls -name kMDItemContentType` to confirm the UTI matches the container extension.
4. Compare `du -sh out/*.mov` against the per-episode file-size cap in the client spec.
5. Verify the delivery manifest filename list matches the folder listing: `ls out/ | sort > /tmp/have.txt && diff -u manifest.txt /tmp/have.txt`.
6. Upload only after all five steps pass, and keep `spec.conf` and the script in the project repo so the next version uses the same rules.

## Will your masters fit on the Intel Mac VM for an ffprobe pass?

The [Intel Mac VM](/mac-hosting#intel-vm) is enough for probing a folder of masters: $2 a day or $25 a month, 4 shared vCPUs, 4GB of memory and 80GB of storage that includes macOS. ffprobe does not touch pixel data. Check that your masters fit in 80GB, or use the Apple Silicon Mac VM 8 GB (100GB, $12 a day) or the [Dedicated M4 Pro 48 GB](/mac-hosting#dedicated-m4-pro) (512GB, $349 a month). If the same session also transcodes or renders the master, we have not measured GPU, media-engine or encoder speed on any plan, so test your own file first: by the day on an Apple Silicon Mac VM, or in the first days of a month on the Dedicated M4 Pro 48 GB. Arithmetic for a one-day QC pass on the Intel VM: $2, against $0.15 an hour if the check takes under a day (13 hours or fewer costs less than $2). Software licences are yours.

**Related guides:**
- [Run a multitrack remote session in Adobe Audition](/blog/mac-audition-multitrack-remote-session)
- [Validate Metal GPU filter output on a rented Mac](/blog/mac-metal-gpu-filter-validation)
- [Set up a GitHub Actions self-hosted runner on a rented Mac](/blog/mac-github-actions-self-hosted-runner)
