forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

gen.sh32 lines, 1.4 KiBHistoryRawDownload
1#!/usr/bin/env bash
2# gen.sh — regenerate the display-matrix fixtures in this directory.
3#
4# `rot<deg>.mp4` are one 320x240 testsrc2 clip (deterministic content) written
5# back out with an ISO-BMFF `tkhd` display matrix asking for `deg` degrees:
6# exactly how a phone records a portrait video (the pixels stay landscape and
7# the container says which way to turn them). A player that ignores the matrix
8# shows the picture sideways, which is the bug these fixtures exist to catch.
9#
10# `-display_rotation` is an *input* option here, so it goes **before** the `-i`
11# it applies to; the `-metadata:s:v rotate=90` form every search result gives
12# writes no display matrix at all with this machine's ffmpeg.
13#
14# Bit-exact reproduction (ffmpeg 8.1.2, libx264): the whole directory is
15# regenerated with the same bytes the committed fixtures carry -- the four
16# differs only inside the tkhd matrix. Verify with `sha256sum rot*.mp4`.
17#
18# Usage: crates/ec-mp4/tests/data/gen.sh
19set -euo pipefail
20
21here=$(cd -- "$(dirname -- "$0")" && pwd)
22src=$(mktemp --suffix=.mp4)
23trap 'rm -f -- "$src"' EXIT
24
25ffmpeg -nostdin -y -v error -f lavfi \
26 -i "testsrc2=size=320x240:rate=24:duration=1" \
27 -c:v libx264 -profile:v baseline -pix_fmt yuv420p "$src"
28
29for deg in 0 90 180 270 45; do
30 ffmpeg -nostdin -y -v error -display_rotation "$deg" -i "$src" \
31 -c copy "$here/rot$deg.mp4"
32done