Just a simple wrapper around a few commands that are shown on http://mightylegends.zapto.org/dvd/dvdauthor_howto.php
#!/usr/bin/perl ########################################################## # # # Author: Gavin Henry # # Web: http://www.perl.me.uk # # # # Version: 0.1 - 28.11.05 # # # # Quick wrapper script to convert an avi # # to a dvd image, using howto at: # # # # http://mightylegends.zapto.org/dvd/dvdauthor_howto.php # # # # Licence: GPL # # # ########################################################## use strict; use warnings; use IO::Prompt; use File::Path; use Cwd; $|++; # First things first my $avi = $ARGV[0] or die "No avi file given!\n \tUsage: $0 filename.avi\n"; # use menu option from IO::Prompt my $choice = prompt -tty, 'Please choose your DVD format...', -1, -menu => [ 'PAL', 'NTSC', 'Quit', ]; print "You chose: [$choice]\n\n"; my $action_ref = { 'PAL' => \&start_pal_dvd, 'NTSC' => \&start_ntsc_dvd, 'Quit' => sub { print "You didn't want to convert $avi, bye\n"; ex +it 0; }, }; # Call our function, depending on what's in $choice if ( $action_ref->{$choice} ) { $action_ref->{$choice}->($avi); } else { warn "Unknown option: '$choice';\n" } #################### sub start_pal_dvd { # #################### my $avi = shift; system "transcode -i $avi -y ffmpeg --export_prof dvd-pal --export +_asr 3 -o $avi -D0 -b224 -N 0x2000 -s2 -m $avi.ac3 -J modfps=clonetyp +e=3 --export_fps 25"; } ##################### sub start_ntsc_dvd { # ##################### my $avi = shift; system "transcode -i $avi -y ffmpeg --export_prof dvd-ntsc --expor +t_asr 3 -o $avi -D0 -b224 -N 0x2000 - s2 -m $avi.ac3 -J modfps=clonet +ype=3 --export_fps 25"; } # Test if above worked, then create a mpg file system "mplex -f8 -o $avi.mpg $avi.m2v $avi.ac3" if ( ( -e "$avi.m2v" ) && ( -e "$avi.ac3" ) ) or die "Transcoding didn't work, please check for the error.\n"; # Chapters every 10 mins my $dvdauthor_xml =<< "DVD_STRUCT"; <dvdauthor dest="./DVD-Final"> <vmgm /> <titleset> <titles> <pgc> <vob file="$avi.mpg" chapters="0,10,20,30,40,50,60,70,80,90,10 +0,110,120"/> </pgc> </titles> </titleset> </dvdauthor> DVD_STRUCT open DVD_XML, ">dvdauthor.xml" or die "Can't create dvdauthor.xml: $!"; print DVD_XML "$dvdauthor_xml"; close DVD_XML; # Create DVD structure if mpg file exists system "dvdauthor -x dvdauthor.xml" if ( (-e "$avi.mpg") && (-d "./DVD-Final") ) or die "No mpg file found\n"; # Finally, make the iso ready to burn using the DVD-Final directory system "mkisofs -dvd-video -o $avi.iso ./DVD-Final"; rmtree(['./DVD-Final'], 1, 1) if ( ( -e "$avi.iso" ) && ( prompt( "Remove DVD-Final directory? ", - +tyn1s => 0.2 ) ) ); # Ask if we want to burn the DVD system "sudo dvdrecord -speed=4 -dao -driveropts=burnfree dev=/dev/hdd + -eject $avi.iso" if ( prompt( "Burn DVD? ", -tyn1s => 0.2 ) ) or die "OK, do it later then.\n"; print "All done. Please check the DVD works in your normal player\n";
|
|---|