render_video/230101/setup.sh

27 lines
618 B
Bash
Executable file

#!/bin/busybox ash
set -euo pipefail
rm C*.mp4 || true
function render_clip() {
local c0 c1 freq out
c0="$1"
c1="$2"
freq="$3"
out="$4"
ffmpeg -hide_banner -vaapi_device /dev/dri/renderD128 \
-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,pan=stereo|c0=c0|c1=c0[a]
" \
-map "[v]" -map "[a]" \
-c:v h264_vaapi -r 25 -t 4 \
-c:a aac -b:a 128000 \
"$out"
}
render_clip '#0000FF' '#FF0000' 400 C01.mp4
render_clip '#00FF00' '#0000FF' 440 C02.mp4
render_clip '#FF0000' '#00FF00' 480 C03.mp4