Tovid Wiki


102pages on
this wiki
Add New Page
Talk0 Share

Just a small documentation on how I use tovid suite of tools. This is more of a mini-howto on making dvd disc from avi video clips. You might find it useful. This is accurate for version 0.28. July 2006.

Basic Steps Edit

Encode avi to mpgEdit

I take all the default from tovid since most downloaded clips are in dvd kind of aspect ratio and ntsc frame rate, and my dvd player and tv can handle both pal and ntsc anyway. So I repeat the command line for all the avi.

 $ tovid -in c1.avi -out c1

Create dvd disk structureEdit

Again I take all the default. The only thing I need to make sure is that all .mpg files total up is less then 4.4gb.

 $ todisc -files c1.mpg c2.mpg c3.mpg -titles "clip1" "clip2" clip3" -out dvd

Burn the diskEdit

I check again to make sure that the output dir (dvd) is below 4.4gb before I burn the disk.

 $ makedvd -burn dvd

Fine TuningEdit

The default provided by tovid is quite good for most video clip but there are always personal preferences.

Reduce the bitrateEdit

Since all downloaded .avi are not top of the line kind of content lower the bitrate does not really impact the quality. I find vbitrate at 2000 is actually good enough in most cases. I would just set it at 3000.

 $ tovid -in c1.avi -out c1 -vbitrate 3000

If the file size is still too big for you bring the bit rate down to 2000 and/or add -bdvd

 $ tovid -in c1.avi -out c1 -vbitrate 2000 -bdvd

Adjust Audio LevelEdit

Normalize the audio level is necessary. Most video clips came with different audio volume. It is always nice to normalize them. More importantly I want my dvd's audio level for my dvd player to match the level of my TV program's volume. I find that normalize provide a volume a bit lower for my dvd player. So, I do a -amplitude 0.4 to push the volume up.

 $ tovid -in c1.avi -out c1 -amplitude 0.4

Check Video/Audo syncEdit

I would also check the result mpg using mplayer to make sure that the video and audio are in sync. I use "+" "-" key in mplayer to adjust the sync while playing.If need be I do a postproc to adjust the out-of-sync problem using the delay number from mplayer. c1a.mpg is the adjusted file with audio playing faster by 200ms for example.

 $ postproc -audiodelay -200 c1.mpg c1a.mpg

Set Chain PlayEdit

todisc by default stop at each clip and return to menu on a dvd player. You can decide if each clip should chain play the next or stop at menu after play. For example, if I have a 5 clips dvd and they make up of 2 full movies. I would use the following command to produce the dvd.

 $ todisc -files c1.mpg c2.mpg c3.mpg c4.mpg c5.mpg \
          -titles "movie1 part1" "movie1 part2" "movie2 part1" "movie2 part2" movie2 part3" \
          -out dvd \
          -chain-videos 1 3 4

Note: -chain-videos is not in version 0.28 yet. Pick it up from svn version.

Animation clipEdit

If the clip is the animation video, it maybe good to add an option -type animation to improve the quality.

 $ tovid -in c1.avi -out c1 -amplitude 0.4 -type animation

Add contrastEdit

At time if the clips is too "white", I would add contrast filter.

 $ tovid -in c1.avi -out c1 -amplitude 0.4 -filter contrast


Before burning the disk it is always nice to preview the dvd. Some how xine need full path to the dvd file system. ./dvd would not work.

 $ xine dvd:/full/path/to/dvd 

Working EnvironmentEdit

Take a look at ~/.tovid directory. I would edit the ~/.tovid/preferences to include the following two lines. This way all temp files will be created in one place, so are the completed mpg files. In my case I like the mpg accessiable from desktop. Also, remember to create that output directory you specified. Encoding job will fail at the end if tovid could not find the output directory. If tovid could not find the tmp directory it will place all temp file on the root (/), as of version 0.28.


Automation Edit

If you are using gnome 2.14 and up, you can try this out as well. I wrote these simple scripts to front-end the tovid and todisc. nstovid for encoding work, nstodisc to generate dvd file system. nspreview frontending xine to preview the dvd and nsmakedvd just to burn a dvd. I have all my preferences in the scripts. They can be kicked off from gnome desktop without having to touch the command line.

NOTE: These script likely to fail if you have space or multiple "." in the file name. Safer to keep the filename to 8.3 format. :) I use only short name for my clips so that todisc will display them on thumbnail dvd menu properly.

Script 1 - nstovidEdit

The script is very simple. At a minimum you need to edit the line OUTDIR="/home/you/Desktop/dvd" to some where and create that directory. The rest are optional.

# nstovid - Gnome Nautilus-scripts frontend to tovid 
# oh June24,2006 updated:July19,2006
[ "X$1" = "X" ] && { echo "Usage: nstovid <file> [<file> <file...>]" ; exit ; }
# user's parameters-------------------------------------------------------------
DvdType="ntsc"                            #default type unless "pal" found
vBitRate=3000                             #normal 5000 - keep low for lowres avi
OutDir="/home/oh/Desktop/dvd"             #default output folder name
AddOpts="-amplitude 0.4 -force"           #needed for my dvd player to up volume
AddOpts="$AddOpts -bdvd"                  #bdvd produce smaller output file.
#AddOpts="$AddOpts -safe 93"              #my toshiba 32WL58's safe area
#AddOpts="$AddOpts -filters all"          #include all filter, denoise/contrast
#AddOpts="$AddOpts -type animation"       #include animation option
# some shortcut-----------------------------------------------------------------
[ -d "$OutDir/pal" ]       && { DvdType="pal";  OutDir="$OutDir/pal" ; }
[ -d "$OutDir/ntsc" ]      && { DvdType="ntsc"; OutDir="$OutDir/ntsc" ; }
[ -d "$OutDir/16x9" ]      && { AddOpts="-aspect 16:9 $AddOpts"; OutDir="$OutDir/16x9" ; }
[ -d "$OutDir/animation" ] && { AddOpts="-type animation $AddOpts"; OutDir="$OutDir/animation" ; }
[ -d "pal" ]               && { DvdType="pal";  OutDir="pal" ; }   
[ -d "ntsc" ]              && { DvdType="ntsc"; OutDir="ntsc" ; } 
# start processing--------------------------------------------------------------
[ ! -z "$1" ] && list="$@";
for file in $list ;
  echo "nstovid - nautilus-scripts frontend to tovid....................."  > $log 2>&1
  # strip the .avi, .mkv, .mov, mp4, or .ogm extension.
  name=`echo $file | sed -e 's/\.[amow][vkgopm][ivm4g]$//'`
  ext=`echo $file | sed -e 's/^.*\.//'`
  if [ ! -f "$name.$ext" ];
    echo "File '$name.$ext' not found!" >>$log 2>&1
    if [ $DvdType = "pal" ]; then
      echo "processing...$file -pal"  >> $log 2>&1
      tovid -pal -vbitrate $vBitRate -in $file -out $OutDir/$name $AddOpts >> $log 2>&1
      echo "processing...$file -ntsc"  >> $log 2>&1
      tovid -vbitrate $vBitRate -in $file -out $OutDir/$name $AddOpts  >> $log 2>&1
  echo "-------------------------------------------------------------" >> $log 2>&1
  echo "nstovid   ended $(date)"    >> $log 2>&1
  echo "nstovid started $StartTime" >> $log 2>&1
  echo "-------------------------------------------------------------" >> $log 2>&1
  mv $log $log.done

Script 2 - nstodiscEdit

You need to edit the line OUTDIR="/home/you/Desktop/dvd" to some where and create that directory. The rest are optional.

# nstodisc - nautilus-scripts frontend todisc svn916
# by oh July17,2006 updated:July18,2006
AddOpts=""                                   #just in case we need additional options 
OUTDIR="/home/oh/Desktop/dvd"                #default output folder name
[ "X$1" = "X" ] && { echo "Usage: nstodisc <file> [<file> <file...>]" ; exit ; }
F="" ; T="" ; C="" ; cnt=0
[ ! -z "$1" ] && list="$@";
for file in $list ;
  cnt=`expr $cnt + 1`
  name=`basename $file ".mpg"`                #remove .mpg from filename if file.mpg
  if [ ! -f "$name.$ext" ];                   #and put it back
    echo "File '$name.$ext' doesn't exist" >>$log 2>&1   #reject non-mpg file
    F="$F $name.$ext" ; T="$T $name" ; C="$C $cnt"
[ -d "$OUTDIR/static" ] && { OUTDIR="$OUTDIR/static"; AddOpts="$AddOpts -static" ; }
echo "todisc -files $F -titles $T -chain-videos $C -out $OUTDIR/dvd $AddOpts" >>$log 2>&1
echo "yes" > yes
todisc -files $F -titles $T -chain-videos $C -out $OUTDIR/mydvd $AddOpts  >>$log 2>&1 < yes
echo "-------------------------------------------------------------"  i   >>$log 2>&1
echo "nstodisc   ended $(date)"    >> $log 2>&1
echo "nstodisc started $StartTime" >> $log 2>&1
echo "-------------------------------------------------------------"      >>$log 2>&1
mv $log $log.done ; rm yes

Script 3 - nspreviewEdit

# nspreview - nautilus-scripts frontend xine to preview dvd
# by oh July17,2006 updated:July18,2006
[ "X$1" = "X" ] && { echo "Usage: nspreview <DIR>" ; exit ; }
[ ! -d "$1/VIDEO_TS" ] &&  { echo "$1/VIDEO_TS not found" ; exit ; }
xine dvd:$PWD/$1

Script 4 - nsmakedvdEdit

# nsmakedvd - nautilus-scripts frontend makedvd to just to burn disc
# by oh July17,2006 updated:July18,2006
[ "X$1" = "X" ] && { echo "Usage: nsmakedvd <DIR>" ; exit ; }
[ ! -d "$1/VIDEO_TS" ] &&  { echo "$1/VIDEO_TS not found" ; exit ; }
echo "makedvd -brun -device /dev/dvd $1"         >>$log 2>&1 
makedvd -burn -device /dev/dvd $1                >>$log 2>&1 
echo "-------------------------------------------------------------"   >>$log 2>&1
echo "nsmakedvd   ended $(date)"    >> $log 2>&1
echo "nsmakedvd started $StartTime" >> $log 2>&1
echo "-------------------------------------------------------------"   >>$log 2>&1
mv $log $log.done 


I'm using gnome's nautilus-script feature. Here is how it work.

 $ mkdir ~/Desktop/dvd                         #make sure this match the script for DIR.
 $ mkdir ~/.gnome2/nautilus-scripts            #create this directly under home to house the scripts
 $ mv nstovid    ~/.gnome2/nautilus-scripts    #move the script in there after editing if necessary
 $ mv nstodisc   ~/.gnome2/nautilus-scripts    #move this script as well.
 $ mv nspreviiew ~/.gnome2/nautilus-scripts
 $ mv nsmakedvd  ~/.gnome2/nautilus-scripts

I think we need to logout and login again for the first time nautilus-scripts folder is created. So, log out and log back in.

How to use themEdit


Single file - On the gnome desktop, open the folder contain all the .avi files. Lets pick and highlight c1.avi, right click over it, select Script, and choose nstovid. The script will take over from here. The result c1.mpg will be placed in your desktop dvd folder. The script also create a file log file c1.avi.12345. We can review the log file using gedit anytime while the processing is going on. When the processing is completed this log file will be renamed to c1.avi.12345.done and seat beside c1.avi. It tell us it is done. :). The "12345" is a the process id so it will be unique. We can have multiple jobs running by simply repeat the process.

Multiple files - We can pick multiple .avi files and kick the script off the same way. It will process all the selected files, one file at a time. Same thing each job will have a co-responding log file. The result .mpg files will be in the output folder. We just need to check if the c1.avi.12345.done is there. If we don't see a .done appended to the of the log file, it is still working hard. We need to review the log's content only if .mpg is not created in output folder.

Special features - You might have noticed that nstovid script is looking for pal and animation folder in OUTDIR. I use this for a quick parameter switch without having to modify the script itself. For example, if we need pal output, just create a pal folder before kicking off the job. The script will know the request, it will encode in pal format, the result will be placed in the pal folder. Similary, if we want the add -type animation for the encoding job, we create a animation folder in the OUTDIR. Remember to remove these folders to switch back to default ntsc.

Limitation of folder - The script would not do pal and animation at the same time now. You can modify how it work to suit your need. For example, this script now check for pal and ntsc folder in current directory. If found it will overwite the OUTDIR and place the result current directory.


Open folder containing the pre-processed mpg files on gnome desktop. Use shift-click and control-click to select the mpg files. Gnome Nautilus will total up and show you the total file size as you pick. Keep it within 4.4gb. Right click, Select Scripts and choose nstodisc.. Look at the log file nstodisc.12345 till it turn nstodisc.12345.done. If everything go well you should see a mydvd in the OUTDIR.. By default we will get animated menu. If you want static menu (faster to produce) just create a folder named static in the OUTDIR. The mydvd will be created in the static folder.


Pick highlight the output dvd folder, mydvd for example. Right click, select Script, choose nspreview. The script will kick off xine to preview the dvd.


Pick and highlight the output dvd folder, mydvd for example. Right click, Select Script, choose nsmakedvd. The script will use makedvd to burn the dvd for you. Make sure that you have a blank dvd in the drive.

I have a wish list, these feature would help automate the process a little bit more.


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki