forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB3d2e08fTahinli7 days ago3929 commits

h264-speed.sh20 lines, 956 bytesHistoryRawDownload
1#!/usr/bin/env bash
2# h264-speed.sh <frames> <threads> [features]: 1080p30 encode speed, noisy and clean testsrc2.
3# Run it through scripts/remote-run.sh. Clips are cached in $HOME/.cache/h264speed.
4set -euo pipefail
5frames=${1:-60}; threads=${2:-1}; feat=${3:-}
6d=$HOME/.cache/h264speed; mkdir -p "$d"
7for kind in noisy clean; do
8 f=$d/$kind-$frames.yuv
9 if [ ! -s "$f" ]; then
10 g="testsrc2=size=1920x1080:rate=30:duration=$(awk -v n="$frames" 'BEGIN{print n/30}')"
11 [ $kind = noisy ] && g="$g,noise=alls=24:allf=t"
12 ffmpeg -nostdin -v error -y -f lavfi -i "$g" -pix_fmt yuv420p -f rawvideo "$f"
13 fi
14done
15cargo build --release -p ec-h264 --example h264_clip_encode ${feat:+--features $feat} 2>&1 | tail -2
16bin=${CARGO_TARGET_DIR:-target}/release/examples/h264_clip_encode
17for kind in noisy clean; do
18 echo "== $kind threads=$threads"
19 bash -c "time \"\$0\" \"\$@\"" "$bin" "$d/$kind-$frames.yuv" 1920 1080 30 4000000 26 "$threads" none
20done