+ Reply to Thread
Results 1 to 1 of 1

Thread: mass video conversion shell script

  1. #1
    hopper's Avatar
    hopper is offline x10 Sophmore hopper is an unknown quantity at this point
    Join Date
    Feb 2008
    Posts
    219

    mass video conversion shell script

    this is a shell script i did that takes a range of sequentially numbered videos (numbered "_#") and converts them to avi format then DVD mpeg2 using mencoder and ffmpeg, even generates the .xml file for dvdauthor, then masters the dvd with DVDauthor and even burns the dvd, all you have to do is run it with the first file and the last file as arguments

    Code:
    #initialize the variable to increment for the jump statement in the xml file
    let y=1
    #remove the old xml file
    rm -f ../mpgs/naruto.xml
    #generate the static part at the begining of the xml file
    echo "<dvdauthor dest=\"DVD\">" > ../mpgs/naruto.xml
    echo "    <vmgm />" >> ../mpgs/naruto.xml
    echo "    <titleset>" >> ../mpgs/naruto.xml
    echo "        <titles>" >> ../mpgs/naruto.xml
    echo "            <video aspect=\"16:9\" format=\"ntsc\" widescreen=\"nopanscan\" />" >> ../mpgs/naruto.xml
    #set the upper bounds for the jump statement to one higher then the number of the last title
    a=$1
    b=$2
    let c=$b-$a
    let z=$c+2 
    #repeat from the first number until the second in sequence
    for ((x=$1;x<=$2;x++))
    do
    #increment the jump variable
    let y=$y+1
    #if on the last title set it to jump to title 1 (loop the dvd)
    if [ \"$y\" = \"$z\" ]
    then 
    let y=1
    fi
    #convert from divx to standard avi then remove the divx
    mencoder -ovc lavc -oac lavc *_$x* -o episode$x.avi
    rm -f *_$x*
    #convert from avi to mpeg2 for dvd then remove the avi
    ffmpeg -i episode$x.avi -target dvd ../mpgs/episode$x.mpg
    rm -f episode$x.avi
    #generate the title part of the xml file
    echo "            <pgc>" >> ../mpgs/naruto.xml
    echo "            <vob file=\"episode$x.mpg\" chapters=\"0,5:00,10:00,15:00,20:00,25:00\"/>" >> ../mpgs/naruto.xml
    echo "                <post> jump title $y; </post>" >> ../mpgs/naruto.xml
    echo "            </pgc>" >> ../mpgs/naruto.xml
    done
    #add the closing tags to the divx
    echo "        </titles>" >> ../mpgs/naruto.xml
    echo "    </titleset>" >> ../mpgs/naruto.xml
    echo "</dvdauthor>" >> ../mpgs/naruto.xml
    #switch to the mpgs directory
    cd ../mpgs
    #generate the raw DVD image from the mpgs
    dvdauthor -x naruto.xml
    #burn the dvd
    growisofs -Z /dev/dvd -dvd-video DVD/
    #clean up
    rm -rf *.mpg
    rm -rf DVD
    edit: note the rm -f commands in the script are optional i just put them in there because of lack of space on my harddrive, but if you leave them in make sure you are working on a COPY of the original because otherwise youll lose the original wether it worked or not
    Last edited by hopper; 04-28-2008 at 05:35 PM.

+ Reply to Thread

Similar Threads

  1. Guess that YouTube video!
    By Smith6612 in forum Off Topic
    Replies: 9
    Last Post: 03-18-2008, 04:08 PM
  2. Replies: 8
    Last Post: 12-03-2007, 04:12 PM
  3. phpBB arcade to SMF Arcade conversion script
    By Christopher in forum The Marketplace
    Replies: 2
    Last Post: 05-23-2007, 09:22 PM
  4. Server UP time Script
    By dharmil in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 04-03-2006, 04:39 PM
  5. PSP Video 9
    By N2PGames in forum Gamer's Lounge
    Replies: 0
    Last Post: 02-26-2006, 10:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers