forge
Explore
Log in

Don't you dare go Hollow

edith

Clone
★ 0

0 watching0 forksRust18.3 MiBcc667e6Tahinli3 months ago285 commits

gen_fixtures.sh328 lines, 20.4 KiBHistoryRawDownload
1#!/usr/bin/env bash
2# Regenerates the gitignored test fixtures under assets/.
3# Needs the ffmpeg CLI (dev tool only — the app itself never uses ffmpeg).
4set -euo pipefail
5cd "$(dirname "$0")/.."
6mkdir -p assets
7ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=5 \
8 -c:v libx264 -profile:v baseline -pix_fmt yuv420p assets/test_baseline.mp4
9ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=5 \
10 -c:v libx264 -profile:v high -pix_fmt yuv420p assets/test_high.mp4
11# A/V fixture: video + stereo AAC. Left channel 440 Hz, right 880 Hz, so
12# channel mapping mistakes are audible; 1 Hz volume pulse makes drift visible.
13ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=5 \
14 -f lavfi -i "sine=frequency=440:duration=5" \
15 -f lavfi -i "sine=frequency=880:duration=5" \
16 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \
17 -map 0:v -map "[a]" -c:v libx264 -profile:v baseline -pix_fmt yuv420p \
18 -c:a aac -b:a 128k assets/test_av.mp4
19# Second A/V fixture for multi-file import: same properties as test_av.mp4
20# (1280x720@30 baseline, AAC-LC 44.1k stereo) but plainly different content —
21# testsrc pattern, 4 s, an octave up (660/1320 Hz) with the same 1 Hz pulse.
22ffmpeg -y -f lavfi -i testsrc=size=1280x720:rate=30:duration=4 \
23 -f lavfi -i "sine=frequency=660:duration=4" \
24 -f lavfi -i "sine=frequency=1320:duration=4" \
25 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \
26 -map 0:v -map "[a]" -c:v libx264 -profile:v baseline -pix_fmt yuv420p \
27 -c:a aac -b:a 128k assets/test_av2.mp4
28# Multi-audio fixture: one video and three audio streams, so stream selection
29# has something to select. Stream 0 is AAC 44.1k stereo (440 Hz left, 880 Hz
30# right), stream 1 is AAC 22.05k mono 220 Hz tagged French — different rate,
31# layout and content, so a test can tell which stream it was handed — and
32# stream 2 is AC-3, the codec we cannot decode and must still list.
33ffmpeg -y -f lavfi -i testsrc2=size=320x240:rate=30:duration=2 \
34 -f lavfi -i "sine=frequency=440:duration=2" \
35 -f lavfi -i "sine=frequency=880:duration=2" \
36 -f lavfi -i "sine=frequency=220:duration=2" \
37 -f lavfi -i "sine=frequency=330:duration=2" \
38 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo[a0]" \
39 -map 0:v -map "[a0]" -map 3:a -map 4:a \
40 -c:v libx264 -profile:v baseline -pix_fmt yuv420p \
41 -c:a:0 aac -ar:a:0 44100 -ac:a:0 2 \
42 -c:a:1 aac -ar:a:1 22050 -ac:a:1 1 \
43 -c:a:2 ac3 -ar:a:2 44100 -ac:a:2 2 \
44 -metadata:s:a:1 language=fra assets/test_multiaudio.mp4
45# Unsupported-audio fixture: an AC-3 track, which we cannot decode at all. The
46# file plays as picture with silence, and the point is that it says so.
47ffmpeg -y -f lavfi -i testsrc2=size=320x180:rate=30:duration=2 \
48 -f lavfi -i "sine=frequency=440:duration=2" \
49 -map 0:v -map 1:a -c:v libx264 -profile:v baseline -pix_fmt yuv420p \
50 -c:a ac3 -b:a 192k assets/test_ac3.mp4
51# The shape a BluRay remux has: 48 kHz 5.1 AC-3, which the decoder downmixes to
52# stereo for the timeline. The mono fixture above is the other end of the same
53# path — no downmix at all — and both have to work.
54ffmpeg -y -f lavfi -i testsrc2=size=320x180:rate=30:duration=2 \
55 -f lavfi -i "sine=frequency=440:duration=2:sample_rate=48000" \
56 -map 0:v -map 1:a -c:v libx264 -profile:v baseline -pix_fmt yuv420p \
57 -ac 6 -c:a ac3 -b:a 448k assets/test_ac3_51.mp4
58# Multi-language fixture: the shape real media has — one video and two AAC
59# streams that *agree* on rate and layout (44.1k stereo) and differ only in
60# language and content, 440/880 Hz undefined and 220/330 Hz French. One
61# timeline means one set of audio parameters, so this is the file where the
62# second stream can actually be put on the timeline; test_multiaudio.mp4 is the
63# file where it cannot, and both cases have to be shown.
64ffmpeg -y -f lavfi -i testsrc2=size=320x240:rate=30:duration=2 \
65 -f lavfi -i "sine=frequency=440:duration=2" \
66 -f lavfi -i "sine=frequency=880:duration=2" \
67 -f lavfi -i "sine=frequency=220:duration=2" \
68 -f lavfi -i "sine=frequency=330:duration=2" \
69 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo[a0];\
70[3:a][4:a]join=inputs=2:channel_layout=stereo[a1]" \
71 -map 0:v -map "[a0]" -map "[a1]" \
72 -c:v libx264 -profile:v baseline -pix_fmt yuv420p \
73 -c:a aac -ar 44100 -ac 2 \
74 -metadata:s:a:1 language=fra assets/test_multilang.mp4
75# VP9 fixture: the same A/V shape as test_av.mp4 (1280x720@30, AAC-LC 44.1k
76# stereo) with a VP9 picture, so what the tests measure is the codec and
77# nothing else. 2 s, because VP9 only ever decodes on the hardware path.
78ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=2 \
79 -f lavfi -i "sine=frequency=440:duration=2" \
80 -f lavfi -i "sine=frequency=880:duration=2" \
81 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \
82 -map 0:v -map "[a]" -c:v libvpx-vp9 -b:v 2M -pix_fmt yuv420p \
83 -c:a aac -b:a 128k assets/test_vp9.mp4
84# HEVC fixture: the same A/V shape again, so the tests measure the codec and
85# nothing else. 8-bit Main profile, because the plugin's NV12 read-back cannot
86# carry Main 10.
87ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=2 \
88 -f lavfi -i "sine=frequency=440:duration=2" \
89 -f lavfi -i "sine=frequency=880:duration=2" \
90 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \
91 -map 0:v -map "[a]" -c:v libx265 -tag:v hev1 -pix_fmt yuv420p \
92 -c:a aac -b:a 128k assets/test_hevc.mp4
93# The same HEVC stream tagged hvc1, which is what Apple and ffmpeg's mov muxer
94# write in practice: mp4 0.14 recognises only a hev1 sample entry, so this one
95# is found by demux.rs reading the stsd fourcc itself (`tests/hevc_hvc1.rs`).
96ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=2 \
97 -f lavfi -i "sine=frequency=440:duration=2" \
98 -f lavfi -i "sine=frequency=880:duration=2" \
99 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \
100 -map 0:v -map "[a]" -c:v libx265 -tag:v hvc1 -pix_fmt yuv420p \
101 -c:a aac -b:a 128k assets/test_hevc_hvc1.mp4
102# AV1 fixture, and the only Matroska one: `mp4 0.14` has no `av01` sample entry
103# at all, so AV1 is read out of an mkv (`demux::MkvDemuxer`). Same A/V shape as
104# the others so the tests measure the codec and nothing else -- but `-g 30` is
105# not a preference: it puts a second keyframe at frame 30, which is what the
106# sync index and the seek test are checked against. 8-bit Main profile here; the
107# 10-bit twin is below. Its AAC track is deliberate too: it is the AAC a Matroska
108# file's sound is read out of through symphonia, beside the AC-3 fixtures further
109# down that no symphonia version decodes.
110ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=2 \
111 -f lavfi -i "sine=frequency=440:duration=2" \
112 -f lavfi -i "sine=frequency=880:duration=2" \
113 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \
114 -map 0:v -map "[a]" -c:v libsvtav1 -preset 8 -g 30 -pix_fmt yuv420p \
115 -c:a aac -b:a 128k assets/test_av1.mkv
116# ...and the same file 10-bit, which is what an `av1C` with `high_bitdepth` set
117# reads as and what the P010 surface pool is picked by -- the AV1 seat of the
118# pair test_hevc.mkv/test_hevc10.mkv already make for HEVC. libaom rather than
119# SVT-AV1 because it is the encoder that writes a 10-bit `av1C` here.
120ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=2 \
121 -f lavfi -i "sine=frequency=440:duration=2" \
122 -f lavfi -i "sine=frequency=880:duration=2" \
123 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \
124 -map 0:v -map "[a]" -c:v libaom-av1 -cpu-used 8 -row-mt 1 -g 30 -pix_fmt yuv420p10le \
125 -c:a aac -b:a 128k assets/test_av1_10.mkv
126# H.264 in Matroska: the same stream the mp4 fixtures carry, in the container
127# that used to refuse it. Baseline profile so `rusty_h264` reads it with nothing
128# installed, `-g 30` for the second keyframe the sync index is checked against,
129# and the AAC track for the sound an mkv's audio path reads back.
130ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=2 \
131 -f lavfi -i "sine=frequency=440:duration=2" \
132 -f lavfi -i "sine=frequency=880:duration=2" \
133 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \
134 -map 0:v -map "[a]" -c:v libx264 -profile:v baseline -g 30 -pix_fmt yuv420p \
135 -c:a aac -b:a 128k assets/test_h264.mkv
136# Subtitles in Matroska: the two text codecs a film carries, muxed out of the
137# hand-written files the tests also parse standalone
138# (`crates/engine/tests/data/`), so the embedded cues and the external ones can
139# be compared to each other and both to the source. Track 2 is S_TEXT/UTF8 and
140# track 3 is S_TEXT/ASS -- the same three cues, one of them with markup, which
141# is what makes "the markup is resolved, not carried" measurable.
142#
143# No bitmap track here: ffmpeg cannot encode text subtitles into pictures, so
144# the PGS refusal is checked against a Matroska file the test writes itself
145# (`crates/engine/tests/subtitles.rs`).
146ffmpeg -y -f lavfi -i testsrc2=size=320x240:rate=30:duration=5 \
147 -i crates/engine/tests/data/test_subs.srt \
148 -i crates/engine/tests/data/test_subs.ass \
149 -map 0:v -map 1:0 -map 2:0 \
150 -c:v libsvtav1 -preset 8 -g 30 -pix_fmt yuv420p \
151 -c:s:0 srt -metadata:s:s:0 language=eng \
152 -c:s:1 ass -metadata:s:s:1 language=fra -metadata:s:s:1 title=Signs \
153 assets/test_subs.mkv
154# HEVC in Matroska: the shape a film off a disc arrives in. Same A/V shape as
155# test_hevc.mp4 so the tests measure the container and nothing else, `-g 30` for
156# the same reason test_av1.mkv has it (a second keyframe to seek to), and the
157# AAC track is read out of the mkv now rather than named as unsupported.
158ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=2 \
159 -f lavfi -i "sine=frequency=440:duration=2" \
160 -f lavfi -i "sine=frequency=880:duration=2" \
161 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \
162 -map 0:v -map "[a]" -c:v libx265 -x265-params log-level=error -g 30 -pix_fmt yuv420p \
163 -c:a aac -b:a 128k assets/test_hevc.mkv
164# ...and the same file in the shape the ask came from: HEVC **Main 10** with a
165# 5.1 AAC track, which is a 4K BluRay remux in miniature. The picture decodes
166# through a P010 surface pool and the sound is folded to stereo, so both halves
167# of that file have a fixture. One tone per channel -- 440 FL, 880 FR, 220 FC,
168# 60 LFE, 1320 BL, 1760 BR as written, whatever the encoder's own element order
169# does with them -- so a test can say which channel reached which output.
170ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=2 \
171 -f lavfi -i "sine=frequency=440:duration=2:sample_rate=48000" \
172 -f lavfi -i "sine=frequency=880:duration=2:sample_rate=48000" \
173 -f lavfi -i "sine=frequency=220:duration=2:sample_rate=48000" \
174 -f lavfi -i "sine=frequency=60:duration=2:sample_rate=48000" \
175 -f lavfi -i "sine=frequency=1320:duration=2:sample_rate=48000" \
176 -f lavfi -i "sine=frequency=1760:duration=2:sample_rate=48000" \
177 -filter_complex "[1:a][2:a][3:a][4:a][5:a][6:a]join=inputs=6:channel_layout=5.1[a]" \
178 -map 0:v -map "[a]" -c:v libx265 -x265-params log-level=error -g 30 -pix_fmt yuv420p10le \
179 -c:a aac -b:a 384k assets/test_hevc10.mkv
180# Matroska sound: the two Dolby codecs that arrive in one and are read straight
181# out of its blocks (`demux::MkvAudio`). Stereo AC-3 for the plain syntax and
182# **5.1 E-AC-3** for Annex E -- the shape a remux has, and the one that must
183# come down to stereo through the same A/52 7.8 downmix the mp4 path uses.
184# 48 kHz both, which is the only rate E-AC-3 is written at in practice. Small
185# H.264 picture on purpose: these two are about the sound, and the software
186# decoder reads that one, so an audio test needs no VA-API plugin to open a
187# session on them.
188ffmpeg -y -f lavfi -i testsrc2=size=320x180:rate=30:duration=2 \
189 -f lavfi -i "sine=frequency=440:duration=2:sample_rate=48000" \
190 -f lavfi -i "sine=frequency=880:duration=2:sample_rate=48000" \
191 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo[a]" \
192 -map 0:v -map "[a]" -c:v libx264 -profile:v baseline -g 30 -pix_fmt yuv420p \
193 -c:a ac3 -b:a 192k assets/test_ac3.mkv
194ffmpeg -y -f lavfi -i testsrc2=size=320x180:rate=30:duration=2 \
195 -f lavfi -i "sine=frequency=440:duration=2:sample_rate=48000" \
196 -map 0:v -map 1:a -c:v libx264 -profile:v baseline -g 30 -pix_fmt yuv420p \
197 -ac 6 -c:a eac3 -b:a 384k assets/test_eac3.mkv
198# Dual audio in Matroska: the shape an anime remux has -- one picture and two
199# AAC tracks that differ in language and content and *agree* on rate and layout
200# (44.1k stereo), so either one can go on the same timeline. Stream 0 is
201# 440/880 Hz English, stream 1 is 220/330 Hz French; the tones are what a test
202# tells the two apart by, and getting the mapping wrong plays the other
203# language. test_multilang.mp4 is this file's mp4 twin.
204ffmpeg -y -f lavfi -i testsrc2=size=320x180:rate=30:duration=2 \
205 -f lavfi -i "sine=frequency=440:duration=2" \
206 -f lavfi -i "sine=frequency=880:duration=2" \
207 -f lavfi -i "sine=frequency=220:duration=2" \
208 -f lavfi -i "sine=frequency=330:duration=2" \
209 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo[a0];\
210[3:a][4:a]join=inputs=2:channel_layout=stereo[a1]" \
211 -map 0:v -map "[a0]" -map "[a1]" \
212 -c:v libx264 -profile:v baseline -g 30 -pix_fmt yuv420p \
213 -c:a aac -ar 44100 -ac 2 \
214 -metadata:s:a:0 language=eng -metadata:s:a:1 language=fra \
215 assets/test_multiaudio.mkv
216# Colour-tag fixtures. The picture is irrelevant here -- what is measured is
217# what the file *says* its numbers mean (`engine::colorspace`), so these are
218# one-second clips with nothing in them.
219#
220# First pair: SMPTE 170M (BT.601) tagged in the container, at 720 lines, where
221# the resolution heuristic would have said BT.709. That is the point: it is the
222# fixture that shows the container tags being read and outranking the guess.
223# Both containers, because the `colr` box and the Matroska `Colour` element are
224# parsed by different code.
225for out in assets/test_bt601.mp4 assets/test_bt601.mkv; do
226 ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=30:duration=1 \
227 -c:v libx264 -profile:v baseline -pix_fmt yuv420p \
228 -colorspace smpte170m -color_primaries smpte170m -color_trc smpte170m \
229 "$out"
230done
231# ...and the tier below it: BT.709 written into the *bitstream* by the encoder
232# and nowhere else. Passing the codes through `-x264-params`/`-x265-params`/
233# `-svtav1-params` rather than through ffmpeg's stream tags leaves the muxer
234# with nothing to write, so these files have no `colr` box at all -- checked by
235# the test. 480 lines, so the heuristic would say BT.601 and a pass means the
236# VUI (or AV1 `color_config`) was really read. The HEVC one asks for
237# `scaling-lists=default` on purpose: a set of scaling lists sits between the
238# SPS header and its VUI, and a walk that counts them wrongly reads the colour
239# out of the middle of a coefficient. (x264 writes its quant matrices into the
240# PPS instead, so the H.264 side of that is a synthetic SPS in the unit tests.)
241ffmpeg -y -f lavfi -i testsrc2=size=640x480:rate=30:duration=1 \
242 -c:v libx264 -profile:v high -pix_fmt yuv420p \
243 -x264-params colormatrix=bt709:transfer=bt709:colorprim=bt709 \
244 assets/test_vui_h264.mp4
245ffmpeg -y -f lavfi -i testsrc2=size=640x480:rate=30:duration=1 \
246 -c:v libx265 -pix_fmt yuv420p \
247 -x265-params log-level=error:scaling-lists=default:colormatrix=bt709:transfer=bt709:colorprim=bt709 \
248 assets/test_vui_hevc.mp4
249ffmpeg -y -f lavfi -i testsrc2=size=640x480:rate=30:duration=1 \
250 -c:v libsvtav1 -preset 8 -pix_fmt yuv420p \
251 -svtav1-params color-primaries=1:transfer-characteristics=1:matrix-coefficients=1 \
252 assets/test_vui_av1.mp4
253# Sync fixture: one flash and one beep, at the same instant. Black picture with
254# a white frame from t=1.0 to t=1.1, silence with a 1 kHz tone over exactly that
255# stretch — so a test can find each of them and say how far apart they came out.
256# What it is for is *speed*: a re-timed clip that drifts puts the beep somewhere
257# the flash is not, and nothing else in the fixture set has a mark to measure
258# that against. Same 30 fps / 44.1k stereo shape as test_av.mp4, so it can share
259# a timeline with the rest.
260# The beep is silence-then-tone-then-silence rather than a gated tone: lavfi's
261# `sine` comes out at an eighth of full scale, and a mark a test looks for has
262# to be plainly louder than anything around it.
263ffmpeg -y -f lavfi -i "color=c=black:s=320x180:r=30:d=3" \
264 -f lavfi -i "sine=frequency=1000:duration=0.1:sample_rate=44100" \
265 -filter_complex "[0:v]drawbox=x=0:y=0:w=iw:h=ih:color=white:t=fill:\
266enable='between(t,1,1.1)'[v];\
267[1:a]volume=6,aformat=channel_layouts=stereo,adelay=1000|1000,apad=whole_dur=3[a]" \
268 -map "[v]" -map "[a]" -c:v libx264 -profile:v baseline -pix_fmt yuv420p \
269 -c:a aac -b:a 128k assets/test_speed_sync.mp4
270# Mismatch fixture: different resolution and no audio track at all, so import
271# has something concrete to refuse.
272ffmpeg -y -f lavfi -i testsrc2=size=640x360:rate=30:duration=2 \
273 -an -c:v libx264 -profile:v baseline -pix_fmt yuv420p assets/test_mismatch.mp4
274# Frame-rate fixture: test_av.mp4 in every respect a timeline is held to -- same
275# codec, same profile, same 44.1k stereo AAC -- except that it runs at 25 fps,
276# so a timeline of 30 fps clips has one at another rate to read through `Rate`.
277ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=25:duration=2 \
278 -f lavfi -i "sine=frequency=440:duration=2" \
279 -f lavfi -i "sine=frequency=880:duration=2" \
280 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \
281 -map 0:v -map "[a]" -c:v libx264 -profile:v baseline -pix_fmt yuv420p \
282 -c:a aac -b:a 128k assets/test_25fps.mp4
283# ...and the same again at 23.976 fps (24000/1001), the rate whose ratio to a
284# 30 fps timeline does not terminate: what the frame mapping's rounding is
285# actually tested against.
286ffmpeg -y -f lavfi -i testsrc2=size=1280x720:rate=24000/1001:duration=2 \
287 -f lavfi -i "sine=frequency=440:duration=2" \
288 -f lavfi -i "sine=frequency=880:duration=2" \
289 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]" \
290 -map 0:v -map "[a]" -c:v libx264 -profile:v baseline -pix_fmt yuv420p \
291 -c:a aac -b:a 128k assets/test_23976fps.mp4
292# Standalone audio fixtures: the same 440/880 Hz tone with the 1 Hz pulse the
293# A/V fixture carries, at test_av.mp4's own 44.1k stereo -- so an imported song
294# can share a timeline with the video clips and the peaks tests can reuse the
295# dip pattern. One per container we claim to read.
296tone="[0:a][1:a]join=inputs=2:channel_layout=stereo,volume='0.5+0.5*sin(2*PI*t)':eval=frame[a]"
297for fmt in mp3 wav flac ogg m4a aac; do
298 case $fmt in
299 mp3) codec=(-c:a libmp3lame -b:a 128k) ;;
300 wav) codec=(-c:a pcm_s16le) ;;
301 flac) codec=(-c:a flac) ;;
302 ogg) codec=(-c:a libvorbis) ;;
303 # ALAC in mp4, and raw AAC in ADTS -- the two the mp4/AAC packet-copy
304 # path cannot claim: one is not AAC, the other is not in an mp4.
305 m4a) codec=(-c:a alac) ;;
306 aac) codec=(-c:a aac -b:a 128k -f adts) ;;
307 esac
308 ffmpeg -y -f lavfi -i "sine=frequency=440:duration=3" \
309 -f lavfi -i "sine=frequency=880:duration=3" \
310 -filter_complex "$tone" -map "[a]" -ar 44100 "${codec[@]}" \
311 "assets/test_tone.$fmt"
312done
313# Still-image fixture: the source with a picture and no timeline in it. Two
314# bands rather than one colour, so a test can tell top from bottom (a flipped
315# decode) and red from blue (a swapped channel order); 640x360, which is 16:9
316# like the video fixtures, so a Fit onto 1280x720 covers the canvas with no
317# bars and every pixel of the exported frame is the image.
318ffmpeg -y -f lavfi -i "color=c=red:s=640x180,format=rgb24" \
319 -f lavfi -i "color=c=blue:s=640x180,format=rgb24" \
320 -filter_complex "[0:v][1:v]vstack=inputs=2,format=rgb24" \
321 -frames:v 1 assets/test_still.png
322# The refusal fixture: same tone at 48k, which one output device cannot mix
323# with a 44.1k timeline.
324ffmpeg -y -f lavfi -i "sine=frequency=440:duration=3" \
325 -f lavfi -i "sine=frequency=880:duration=3" \
326 -filter_complex "$tone" -map "[a]" -ar 48000 -c:a pcm_s16le \
327 assets/test_tone_48k.wav
328echo "fixtures written to assets/"