Last active
December 15, 2015 16:59
-
-
Save jbuchbinder/5293571 to your computer and use it in GitHub Desktop.
mp4 to iso conversion script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# mp4-to-iso.sh - @jbuchbinder | |
# Simple MP4-to-DVD ISO conversion script | |
if [ $# -ne 2 ]; then | |
echo "syntax: $0 input output" | |
echo "example: $0 DemoReel.mp4 DEMOREEL" | |
exit | |
fi | |
in="$1" | |
out="$2" | |
# Check for tools | |
TOOLS="" | |
if [ `which dvdauthor 2>&1 > /dev/null ; echo $?` -ne 0 ]; then | |
TOOLS="${TOOLS} dvdauthor" | |
fi | |
if [ `which avconv 2>&1 > /dev/null ; echo $?` -ne 0 ]; then | |
TOOLS="${TOOLS} avconv" | |
fi | |
if [ `which mkisofs 2>&1 > /dev/null ; echo $?` -ne 0 ]; then | |
TOOLS="${TOOLS} mkisofs" | |
fi | |
if [ "$TOOLS" -ne "" ]; then | |
echo "Could not find required tool(s) on path:${TOOLS}" | |
exit 1 | |
fi | |
# Convert to MPEG video | |
# OLD: used tovid -- too much setup | |
#tovid mpg -in "$in" -out "$out" -dvd -ntscfilm -noask -overwrite | |
# NEW: use avconv, which comes with ffmpeg / libav-tools (Ubuntu/Debian) | |
#avconv -i "$in" -c:v mpeg2video -q:v 2 -c:a libmp3lame "${out}.mpg" | |
avconv -i "$in" -f dvd -target film-dvd -q:v 2 "${out}.mpg" | |
# Use dvdauthor to create the proper structure | |
VIDEO_FORMAT=NTSC dvdauthor -o "$out" -t "${out}.mpg" | |
VIDEO_FORMAT=NTSC dvdauthor -o "$out" -T | |
# mkisofs does the rest | |
mkisofs -v -dvd-video -o "${out}.iso" "$out" | |
# Clean up | |
if [ -f "${out}.iso" ]; then | |
rm -rf "${out}" "${out}.mpg" | |
fi | |
echo "Created '${out}.iso'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment