#!/usr/bin/env bash set -euo pipefail # Reference "DVD-safe" NTSC MPEG-2 encoder. # # This is the known-good baseline that the DeVeDe-NG hardsub fork's # "Compatibility (4500k)" encode profile is modelled on. It is kept here as a # standalone tool and as a regression reference: the fork's generated ffmpeg # command for the Compatibility profile (without subtitle burn-in) should # produce equivalent output (mpeg2video / 720x480 / 29.97fps / AC3 192k 48kHz). # # It does NOT detect or burn subtitles and does NOT split long movies; those # features live in the GUI fork (see FORK_NOTES.md). if [ $# -lt 1 ]; then echo "Usage: $0 input_video" exit 1 fi INPUT="$1" BASENAME="$(basename "$INPUT")" NAME="${BASENAME%.*}" OUTPUT="${NAME}-dvdsafe.mpg" echo "Input: $INPUT" echo "Output: $OUTPUT" echo "Encoding DVD-safe MPEG-2 (CBR 4500k)..." ffmpeg -y -i "$INPUT" \ -vf "scale=720:480:flags=lanczos,\ fps=30000/1001,\ format=yuv420p,\ setsar=1" \ -r 30000/1001 \ -c:v mpeg2video \ -b:v 4500k \ -minrate 4500k \ -maxrate 4500k \ -bufsize 1835k \ -g 15 \ -sc_threshold 0 \ -pix_fmt yuv420p \ -c:a ac3 \ -b:a 192k \ -ar 48000 \ -ac 2 \ "$OUTPUT" echo "Done: $OUTPUT"