forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB86fb0f3Tahinli7 days ago3927 commits

gen-bitmap-sub-fixtures.sh22 lines, 1.4 KiBHistoryRawDownload
1#!/usr/bin/env bash
2# gen-bitmap-sub-fixtures.sh: regenerate the DVD/DVB subtitle fixtures of ec-dvdsub and ec-dvbsub.
3#
4# A synthetic 720x576 PGS source (scripts/gen-bitmap-sub-fixtures.py, PIL text, four cues at
5# 0.5-1.5, 2.0-3.2, 3.5-4.5, 5.0-6.0 s) is encoded by ffmpeg's dvdsub and dvbsub encoders (they
6# take bitmaps only). Needs ffmpeg and python3 with PIL. dvd.idx is written by hand from dvd.sub.
7set -euo pipefail
8ROOT=$(cd -- "$(dirname -- "$0")/.." && pwd)
9T=$(mktemp -d "${TMPDIR:-/tmp}/bitmapsub.XXXXXX")
10trap 'rm -rf "$T"' EXIT
11python3 "$ROOT/scripts/gen-bitmap-sub-fixtures.py" "$T/src.sup"
12S=(-fix_sub_duration -f sup -i "$T/src.sup")
13DVD="$ROOT/crates/ec-dvdsub/tests/data"; DVB="$ROOT/crates/ec-dvbsub/tests/data"
14mkdir -p "$DVD" "$DVB"
15ffmpeg -v error -y "${S[@]}" -c:s dvdsub -map 0 "$DVD/dvd.mkv"
16ffmpeg -v error -y -f lavfi -i color=c=black:s=720x576:r=25:d=7 "${S[@]}" -c:v mpeg2video -b:v 200k \
17 -maxrate 9000k -bufsize 1835k -c:s dvdsub -map 0 -map 1 -target pal-dvd -an "$DVD/dvd.vob"
18ffmpeg -v error -y -f lavfi -i color=c=black:s=64x64:r=5:d=7 "${S[@]}" -c:v mpeg4 -c:s dvdsub -map 0 -map 1 "$DVD/dvd.mp4"
19ffmpeg -v error -y "${S[@]}" -c:s dvdsub -map 0 -f vob "$DVD/dvd.sub"
20ffmpeg -v error -y -f lavfi -i color=c=black:s=64x64:r=5:d=7 "${S[@]}" -c:v mpeg2video -b:v 50k -c:s dvbsub -map 0 -map 1 "$DVB/dvb.ts"
21ffmpeg -v error -y "${S[@]}" -c:s dvbsub -map 0 "$DVB/dvb.mkv"
22echo "fixtures written (dvd.idx is hand-made; see the test)"