...but want to show them to [a] friend[s] when/where there’s no computer available? This script will turn a directory full of video files into a DVD:
#!/bin/sh
FILES="$(for x in *.flv *.mp4 *.mpg *.avi; do echo $x; done | grep -v '^\*' | sort)"
for f in ${FILES}; do
n=$(echo $f | sed -e 's/\.[a-zA-Z0-9]*$//' -e 's/_+/ /g' -e 's/^/"/' -e 's/$/"/')
NAMES="${NAMES} \"$n\""
done
NAME=$(basename $(pwd) | sed -e 's/_/ /g')
mkdir -p DVD
NEWFILES=""
for f in ${FILES}; do
n="$(basename $(basename $(basename $(basename $f .flv) .mp4) .mpg) .avi).mpg"
NEWFILES="${NEWFILES} DVD/$n"
nice -15 ffmpeg -i $f -target ntsc-dvd -aspect 4:3 -y DVD/$n
done
makemenu -noask -overwrite -ntsc -dvd -align northwest -menu-title "${NAME}" -menu-title-fontsize 32 -font "Helvetica" -fontsize 24 -textcolor "rgb(255,255,255)" -fontdeco '-stroke rgb(0,0,0) -strokewidth 1' -button-font "Helvetica" -button ">" -highlightcolor "rgb(255,255,0)" -selectcolor "rgb(255,0,0)" -button-outline "rgb(140,140,140)" "${NAMES}" -out "DVD/${NAME}_menu.mpg"
makexml -overwrite -dvd -menu "DVD/${NAME}_menu.mpg" ${NEWFILES} -out "${NAME}"
makedvd "${NAME}.xml"
At this point, k3b or a similar application will burn the resulting file-tree onto a standard DVD.
This was originally run on a version of Kubuntu (Lucid Lynx) which required /use/share/tovid/ prefixed to each of the make... commands.You may wish to add more potential filetypes (filename suffixes) to the *.flv ... list (anything your version of ffmpeg can handle is fine). Remember to wrap the assorted $(basename)s with one more layer for each additional filetype.
Comments