Actions

Difference between revisions of "Convert VHS to DVD"

From RonWareWiki

Line 25: Line 25:
  
 
=Example script=
 
=Example script=
I call this script 'dvd'.  Invoke it with the name of the ISO image you will
+
call this script 'dvd'.  Invoke it with the name of the ISO image you will
 
want to create (without the .iso extension).  Start playing your VCR, put a
 
want to create (without the .iso extension).  Start playing your VCR, put a
 
blank DVD-R in your writer, and after a bit you'll have a playable DVD of your
 
blank DVD-R in your writer, and after a bit you'll have a playable DVD of your
Line 32: Line 32:
 
#!/bin/bash
 
#!/bin/bash
  
 +
qscale=10 # MPEG quality
 +
duration=7200 # 2 hour tape
 +
target=video # name of the final ISO file
 +
device=/dev/dv1394-0 # Firewire device
 +
writer=/dev/hdc # device for DVD writer
 +
 +
getopt_simple()
 +
{
 +
while [ ! -z "$1" ]
 +
do
 +
case "$1" in
 +
'-30' ) duration=1800 ; qscale=1 ;;
 +
'-60' ) duration=3600 ; qscale=5 ;;
 +
'-120' ) duration=7200 ; qscale=10 ;;
 +
'-240' ) duration=14400 ; qscale=15 ;;
 +
'-d' ) device=$2 ; shift ;;
 +
'-w' ) writer=$2 ; shift ;;
 +
* ) target=$1  ;;
 +
 +
esac
 +
shift
 +
done
 +
}
 +
 +
getopt_simple $*
 +
 +
echo "qscale=$qscale"
 +
echo "device=$device"
 +
echo "duration=$duration"
 +
echo "target=$target"
 +
exit
 
if [ -z "$1" ]
 
if [ -z "$1" ]
 
then
 
then
Line 39: Line 70:
  
 
echo "Generating mpeg from raw DV"
 
echo "Generating mpeg from raw DV"
ffmpeg -f dv1394 -i /dev/dv1394-0 -target dvd -t 7200 -qscale 10 $1.mpg  
+
ffmpeg -f dv1394 -i $device -target dvd -t $duration -qscale $qscale $target.mpg  
  
 
echo "Turning the mpeg into a video DVD file system"
 
echo "Turning the mpeg into a video DVD file system"
dvdauthor -o $1.fs -t $1.mpg
+
dvdauthor -o $target.fs -t $target.mpg
dvdauthor -o $1.fs -T
+
dvdauthor -o $target.fs -T
  
 
echo "Making ISO"
 
echo "Making ISO"
mkisofs -dvd-video -o $1.iso $1.fs
+
mkisofs -dvd-video -o $target.iso $target.fs
  
 
echo "Burning DVD"
 
echo "Burning DVD"
growisofs -dvd-compat -Z /dev/hdc=$1.iso
+
growisofs -dvd-compat -Z $writer=$target.iso
echo "Done!
+
echo "Done!"
 
</pre>
 
</pre>

Revision as of 19:27, 27 June 2007

Introduction

I've been trying to convert old VHS tapes of family events to DVD, so they would remain intact in the future. It is maddeningly difficult to get everything working under Linux, and there doesn't seem to be a "point-and-click" solution which works completely. This page is a guide to how I solved that problem in a manner satisfactory to me.

Requirements

You don't need a lot, but you will need:

  1. A VCR player with audio/video output. Most VCRs will work.
  2. An analog-to-digital converter. Mine is "Firewire" connected, which is recommended for capturing video streams.
  3. A DVD writer, and DVD-R media
  4. 'ffmpeg', with patches
  5. 'dvdauthor'
  6. 'mkisofs'
  7. 'growisofs'

Problems

Lots of things went wrong, trying to convert a simple VHS tape to DVD.

  • At first I tried using Kino, but it always crashed at some point
  • Using "dvgrab" to get the DV (digital video) directly, worked ok - but required over 20G for a 120 minute tape, and another 4G for the mpeg etc. Too much disk space.
  • ffmpeg without options gave a nice small mpeg file, but it was in the wrong format to convert to DVD
  • ffmpeg with the '-target dvd' option make a good mpeg for DVD, but a two-hour tape made an mpeg which was too big
  • the burned DVD would not play in one of my players
  • Saving DV and then converting to mpeg takes almost twice the runtime of the video

Example script

call this script 'dvd'.  Invoke it with the name of the ISO image you will

want to create (without the .iso extension). Start playing your VCR, put a blank DVD-R in your writer, and after a bit you'll have a playable DVD of your VHS tape:

#!/bin/bash

qscale=10			# MPEG quality
duration=7200			# 2 hour tape
target=video			# name of the final ISO file
device=/dev/dv1394-0 		# Firewire device
writer=/dev/hdc			# device for DVD writer

getopt_simple()
{
	while [ ! -z "$1" ]
	do
		case "$1" in
		'-30' 	) duration=1800 ; qscale=1 ;;
		'-60' 	) duration=3600 ; qscale=5 ;;
		'-120' 	) duration=7200 ; qscale=10 ;;
		'-240' 	) duration=14400 ; qscale=15 ;;
		'-d'	) device=$2 ; shift ;;
		'-w'	) writer=$2 ; shift ;;
		*	) target=$1  ;;
				
		esac
		shift
	done
}

getopt_simple $*

echo "qscale=$qscale"
echo "device=$device"
echo "duration=$duration"
echo "target=$target"
exit
if [ -z "$1" ]
then
	echo "Syntax: dvd DV-file-name"
	exit
fi

echo "Generating mpeg from raw DV"
ffmpeg -f dv1394 -i $device -target dvd -t $duration -qscale $qscale $target.mpg 

echo "Turning the mpeg into a video DVD file system"
dvdauthor -o $target.fs -t $target.mpg
dvdauthor -o $target.fs -T

echo "Making ISO"
mkisofs -dvd-video -o $target.iso $target.fs

echo "Burning DVD"
growisofs -dvd-compat -Z $writer=$target.iso
echo "Done!"