One-liners
Detect encoding errors
ffmpeg -err_detect explode -i <infile> -f null -Convert music file to Opus format
find . -type f -name '*.flac' | parallel 'test -f {.}.opus || ffmpeg -i {} -vn -c:a libopus -b:a 192k {.}.opus'Keep display aspect ratio when downsampling
ffmpeg -i in.mp4 -vf "setsar='if(sar,sar,1)',scale=640x480" out.mp4Scripts
Video transcribe with whisper.cpp
Tips: if no copyright issues are involved, you could also upload videos to YouTube and let it auto transcribe them for you.
#!/usr/bin/env bash
set -euo pipefail
MODEL="$HOME/.local/share/whisper-cpp/ggml-base.en.bin"
if [ $# -lt 1 ]; then
echo "Usage: ${0##*/} <input> [output.srt]" >&2
exit 1
fi
input="$1"
output="${2:-${input%.*}.srt}"
if [ -e "$output" ]; then
printf '%s already exists. Remove it? [y/N] ' "$output"
read -r answer
case "$answer" in
[yY]*) rm "$output" ;;
*) exit 0 ;;
esac
fi
tmpout=$(mktemp "${TMPDIR:-/tmp}/transcribe-XXXXXX")
trap 'rm -f "$tmpout"' EXIT
ffmpeg -i "$input" -vn -af \
"whisper=model=${MODEL}:language=en:queue=20:destination=${tmpout}:format=srt" \
-f null -
mv -i "$tmpout" "$output"