prettier test videos

This commit is contained in:
Dominic 2023-10-29 23:07:59 +01:00
parent c55906f70a
commit 30e2dde57d
Signed by: msrd0
GPG key ID: DCC8C247452E98F9

View file

@ -1,24 +1,27 @@
#!/bin/busybox ash
set -euo pipefail
for i in 1 2 3; do rm "C0$i.svg" || true; rm "C0$i.mp4" || true; done
rm C*.mp4 || true
function write_svg() {
echo '<svg viewBox="0 0 1920 1080" width="1920" height="1080">'
echo ' <rect fill="'"$1"'" x="0" y="0" width="1920" height="1080"/>'
echo '</svg>'
}
function render_clip() {
local c0 c1 freq out
c0="$1"
c1="$2"
freq="$3"
out="$4"
write_svg blue >C01.svg
write_svg green >C02.svg
write_svg red >C03.svg
function render_svg() {
ffmpeg -hide_banner -vaapi_device /dev/dri/renderD128 \
-loop 1 -i "$1" \
-filter_complex "[0]format=nv12,hwupload[v];aevalsrc=sin($3*2*PI*t):s=48000[a]" \
-filter_complex "
gradients=s=1920x1080:c0=$c0:c1=$c1:d=4:x0=480:y0=540:x1=1440:y1=540,
format=nv12,hwupload[v];
aevalsrc=sin($freq*2*PI*t):s=48000[a]
" \
-map "[v]" -map "[a]" \
-c:v h264_vaapi -r 25 -t 4 -b:a 128000 "$2"
-c:v h264_vaapi -r 25 -t 4 \
-c:a aac -b:a 128000 \
"$out"
}
for i in 1 2 3; do render_svg "C0$i.svg" "C0$i.mp4" $(($i*40+400)); done
render_clip '#0000FF' '#FF0000' 400 C01.mp4
render_clip '#00FF00' '#0000FF' 440 C02.mp4
render_clip '#FF0000' '#00FF00' 480 C03.mp4