forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB712f5aaTahinli8 days ago3923 commits

bench-rows-clips.sh42 lines, 2.4 KiBHistoryRawDownload
1#!/usr/bin/env bash
2# bench-rows-clips.sh: generate the ffmpeg clips used by scripts/bench-rows.sh.
3# Clips go to $BENCH_CLIPS (default ~/.cache/benchrows-clips), never into the repo.
4# The h264 input is the personal 1080p30 clip that ec-bench's real_video() picks first
5# (first h264 mp4 in ~/Videos or ~/Downloads, sorted by path); it is only read, never copied.
6set -euo pipefail
7d=${BENCH_CLIPS:-$HOME/.cache/benchrows-clips}
8h264_src=${H264_SRC:-$HOME/Downloads/reelk.mp4}
9mkdir -p "$d"
10ff() { ffmpeg -nostdin -v error -y "$@"; }
11
12# VP8 1080p30, libvpx, 10 s, 4 Mb/s, realtime deadline.
13[ -s "$d/vp8-1080p30.ivf" ] || ff -f lavfi -i testsrc2=size=1920x1080:rate=30 -t 10 \
14 -c:v libvpx -b:v 4M -deadline realtime -cpu-used 8 -pix_fmt yuv420p "$d/vp8-1080p30.ivf"
15
16# VP9 profile 0 1080p30, libvpx-vp9, 10 s, 4 tile columns (threads have work to split).
17[ -s "$d/vp9-1080p30-tile4.ivf" ] || ff -f lavfi -i testsrc2=size=1920x1080:rate=30 -t 10 \
18 -c:v libvpx-vp9 -tile-columns 2 -row-mt 1 -b:v 4M -deadline realtime -cpu-used 8 \
19 -pix_fmt yuv420p "$d/vp9-1080p30-tile4.ivf"
20
21# AC-3 5.1 at 448 kb/s, 60 s: six independent pink-noise channels, one per 5.1 speaker
22# (a mono source upmixed would fill only the centre channel and make the parity test vacuous).
23ac3_in=()
24for seed in 1 2 3 4 5 6; do
25 ac3_in+=(-f lavfi -i "anoisesrc=d=60:c=pink:r=48000:a=0.2:seed=$seed")
26done
27[ -s "$d/ac3-5.1-448k.ac3" ] || ff "${ac3_in[@]}" -filter_complex \
28 "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6,pan=5.1(side)|c0=c0|c1=c1|c2=c2|c3=c3|c4=c4|c5=c5[a]" \
29 -map "[a]" -ar 48000 -c:a ac3 -b:a 448k -f ac3 "$d/ac3-5.1-448k.ac3"
30
31# H264 Annex-B, first 10 s of the h264 input, stream copy (same extraction as ec-bench).
32[ -s "$d/h264-1080p30-10s.264" ] || ff -t 10 -i "$h264_src" -an -c:v copy \
33 -bsf:v h264_mp4toannexb -f h264 "$d/h264-1080p30-10s.264"
34
35# ffmpeg reference outputs (raw, the decoded samples the crates must match).
36[ -s "$d/vp8-1080p30.yuv.md5" ] || ffmpeg -nostdin -v error -i "$d/vp8-1080p30.ivf" \
37 -f rawvideo -pix_fmt yuv420p - | md5sum | cut -d' ' -f1 > "$d/vp8-1080p30.yuv.md5"
38[ -s "$d/vp9-1080p30-tile4.yuv.md5" ] || ffmpeg -nostdin -v error -i "$d/vp9-1080p30-tile4.ivf" \
39 -f rawvideo -pix_fmt yuv420p - | md5sum | cut -d' ' -f1 > "$d/vp9-1080p30-tile4.yuv.md5"
40[ -s "$d/ac3-5.1-448k.ref.f32" ] || ffmpeg -nostdin -v error -i "$d/ac3-5.1-448k.ac3" \
41 -f f32le -acodec pcm_f32le -ac 6 "$d/ac3-5.1-448k.ref.f32"
42ls -l "$d"