Howto:DVD Authoring
From IVTV
infirit 00:49, 19 September 2007 (CEST)This page has now been protected. Please discuss on the talk page or on the mailing list how to resolve the continues removing and adding of thescript!
mjcross 19:27, 31 May 2008 (GMT+1) Visitors to this page may be interested to know that a method has subsequently been developed which allows files captured using IVTV to be fed directly into a patched version of dvdauthor without needing to be remultiplexed as described in the initial version of the following. In my experience this can save time and result in more stable longterm audio/video synchronisation. For further information please see the howto here.
Also see the DVD Create DVD How To on former site. The following assumes the use of dvdauthor and mplex from mjpegtools.
Unless you are using a suitably patched version of dvdauthor the audio and video streams need to be remultiplexed. This involves extracting the audio and video streams from the MPEG file, and then recombining them. This does however have a couple of problems: (1) it can take a bit of time (particularly with long clips); and (2) it destroys the audio/video synchronisation information.
Furthermore the dvdauthor man page states:
"The VOBs passed to dvdauthor must have DVD NAV (VOBU) packets multiplexed in at the correct locations. Many tools can do this, including mplex from mjpegtools 1.6.0 or later. dvdauthor will then fill these packets in with the correct data. Special care has been taken to ensure dvdauthor is fifo compliant; that is every source VOB can be the output of another program (such as mplex). This can make execution faster on many systems by avoiding extra filesystem accesses."
If you use the DVD-compatibility stream from the IVTV driver (v4l2-ctl -c stream_type=3) then CX2341x cards, at least, do already insert such packets - so do not insert extra ones with v4l2-ctl -c insert_navigation_packets=1 otherwise dvdauthor will segfault and die.
Then use something like dvdauthor to make the right "file structure" for the DVD. Apparently stand-alone players don't understand files well, but do understand a standardized DVD structure.
The following script adds the DVD NAV packets, creates the DVD structure and burns the DVD. No fancy DVD menus, but the process does add chapters, one for each mpg file. The script works for both PAL and NTSC files.
Notes:
- The remultiplexed file is placed in /recordings/dvd and given the suffix "_modified.mpg"
- The iso file used to burn the DVD is given the suffix .iso
- The script assumes the original file(s) have the suffix .mpg
- The /recordings/dvd and subdirectories will be cleared each time the script is run
#!/bin/bash
Directory="/recordings/dvd"
rm -R $Directory
mkdir $Directory
mkfifo $Directory/aud0
mkfifo $Directory/vid0
ROOT=`basename $1 .mpg`
DVDXML=$Directory/${ROOT}.xml
cat > ${DVDXML} << EOF
<dvdauthor dest="$Directory/${ROOT}.dvd">
<vmgm />
<titleset>
<titles>
<pgc>
EOF
for f in $@; do
base=`basename $f .mpg`
mpeg2desc -a0 < $f > $Directory/aud0 &
mpeg2desc -v0 < $f > $Directory/vid0 &
mplex -f 8 -V -o "$Directory/${base}_modified.mpg" $Directory/aud0 $Directory/vid0
echo "<vob file='$Directory/${base}_modified.mpg' />" >> ${DVDXML}
done
cat >> ${DVDXML} << EOF
</pgc>
</titles>
</titleset>
</dvdauthor>
EOF
if xmllint ${DVDXML} > /dev/null ; then
dvdauthor -x ${DVDXML}
mkisofs -dvd-video -o "$Directory/${ROOT}.iso" $Directory/${ROOT}.dvd/
growisofs -Z /dev/cdrom="$Directory/${ROOT}.iso" --dvd-video --dvd-compat
fi
