Skip to content

Instantly share code, notes, and snippets.

@sbliven

sbliven/vcd2mp4

Created Aug 3, 2020
Embed
What would you like to do?
Convert a VCD .dat file to .mp4 video
#!/bin/bash
# usage: vcd2mp4 output.mp4 input.dat [input2.dat...]
if [[ $# -lt 2 ]]; then
echo "usage: $0 output.mp4 input.dat [input2.dat...]" >&2
exit 1
fi
output="$1"
shift
# concatenate inputs
declare -a PARAMS
if [[ $# -gt 1 ]]; then
FILELIST="$(mktemp vcd2mp4_XXXX)"
while [[ $# > 0 ]]; do
echo "file '$1'" >> "$FILELIST"
shift
done
PARAMS+=(-f concat -safe 0 -i "$FILELIST")
else
PARAMS+=(-i "$1")
shift
fi
PARAMS+=(-vf yadif -c:v libx264 -crf 20 -c:a aac -b:a 128k -movflags +faststart)
PARAMS+=("$output")
echo -n "ffmpeg "
for param in "${PARAMS[@]}"; do echo -n "'$param':q "; done
echo
ffmpeg "${PARAMS[@]}"
code=$?
rm "$FILELIST"
exit $code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.