Virtual Box

After looking over the virtualization with different setups, KVM and VirtualBox I decided to use the virtualbox method because it just appeared to be nicer and with a nice GUI per machine just felt nice.

With the additions of the Guest Additions to allow for sharing of folders from the host machine to the virtual one and also the mouse was no longer taken within the virtual machine, I just liked it and to setup a bridge for the virtual machine to use for the networking I created a small script that does the job of deleting the KVM inserting modules into K/Ubuntu.

Here it is

#!/bin/sh
 
# to remove any kernel modules for kvm and then bring up the bridge for eth0
TMP=`lsmod | grep kvm`
RESULT=`echo $TMP | cut -d \  -f 1,4`
 
if [ -n "$RESULT" ]; then
 
        for i in 1 2
        do
                rmmod `echo $RESULT | cut -d \  -f $i`
        done
else
        echo "No kernel modules"
fi
 
# setup the eth0 for working with the bridge
ifconfig eth0 0.0.0.0
#ifconfig br0 down
 
#setup the bridge and bring it up
brctl addbr br0
brctl addif br0 eth0
 
ifconfig br0 up

How to convert VOB to DVD and Burn

Convert VOB-DVD Image

To create the IFO/BUP files for the VBO files I use a program (the IFO/BUP files are the same file but with different names)

  dvdauthor -o <path-to-file> -T - To generate the Table Of Contents file (TOC)
  cp *.vob <path-to-file>/VIDEO_TS - Copy the files into the video directory
  dvdauthor -o <path-to-file> vobs 

To generate multiple BUP files from the IFO files you could use something like

for file_i in *.IFO; do cp $file_i `basename $file_i .IFO`.BUP; done 

Burn to disk the vcd Image
To burn the dvd files I use a program called K3B for ease of use (K3B is very self explanatory).

How to convert AVI-MPEG to VCD

This shall serve as a reminder for myself and may help others. There is different versions of audio conversion, CBR (Constant Bit Rate) and VBR (Variable Bit Rate), it seems that many DVD players perfer the CBR. Below is both versions with links to the relevant programs and example command lines.

CBR AVI-MPEG

To convert the avi file into a mpeg file for a PAL 352×288 screen, there is different settings either use the ‘man’ or goto the Transcode website for viewing the conversion in more detail. The command line that I use is

transcode -i<AVI FILM> -V -y mpeg -F v,1 -E 44100 -b 224 -fps 25 -o <OUTPUTFILENAME>

This generates two files, *.m1v (the video segment) and *.mpa (the audio segment).

The options in the above command line are

  • -b Audio bitrate Kbit’s
  • -E Audio sampling rate (Hz)
  • -F codec
  • -i input file
  • -V use internal video codec (faster but some import modules do not support this)
  • -y video, audio export modules.
  • -fps Frames per second, 25 is for PAL, 29.97 for NTSC

Joining the OUTPUTFILENAME’s together

To join these two segments together

tcmplex -o <OUTPUT.MPG> -i <OUTPUTFILENAME.M1V> -p <OUTPUTFILENAME.MPA> -m v

This will create a MPEG file ready to be either watched or converted again into the VCD format and then burned.

VBR AVI-MPEG

The programs to download/use are obtained from these links

If the AVI file is in MS MPeg4 v3(DIVX3)

If the INPUT file is in a MS MPeg4 v3 (DIVX3) then you have to convert the file into a DIVX format for FFMPeg to do its stuff. To convert to the required file you will need the mencoder program from MPlayer website. To convert to the required file structure use the commands below.

mencoder -ovc lavc -lavcopts vcodec=mpeg4:vhq -oac copy INPUTFILE.AVI -o OUTPUT.AVI

The options produce a mpeg4 version of the input file using the lavc video converter. Also with the option ‘vhq’, it produces a very high quality output file.

Convert AVI-MPEG

To convert AVI to MPEG use the ffmpeg program, with the commands as below. The INPUT.FILE is in AVI format and the OUTPUT.FILE is an MPEG format

ffmpeg -vcd -i INPUT.FILE -b 1150 -s 352x288 -vcodec mpeg1video -f mpegvideo OUTPUT.FILE

With advice, the ffmpeg build version 4753 (form cvs) the parameters are:-

ffmpeg -target vcd -i INPUT.FILE -b 1150 -s 352x288 -vcodec mpeg1video -f mpegvideo OUTPUT.FIL

The options enable an VCD Mpeg type file output(-vcd) with a bitrate of 1150 (-b) and an output screen size of 352×288 (-s). The codecs to convert to are mpeg1video (-vcodec) so that it is able to be converted to an vcd image with the vcdimager program.
Note: This is still a MPEG file and not a vcd file, you have to use vcdimager below to create a vcd file to burn to disk.

PAL Divx 3 avi file to NTSC vcd

Thanks to Marc for this

ffmpeg -i FILE.AVI -b 1150 -r 29.97 -s 352x240 -aspect 16:9 -vcodec mpeg1video -f mpegvideo FILE-NTSC.mpeg

If MPEG file is bigger than 700MB

If the MPeg file is over the maximum size of the cd, then I use the program mencoder from MPlayer. With the options as below

mencoder -oac copy -ovc copy INPUT.FILE -o OUTPUT.FILE -endpos 670mb

At the end of the copy it should say the frame that the mencoder finished on for the first file. Place that value in the line below (in the VALUE) to create the second value.
I usally subtract about 10 frames just to make sure.

mencoder -oac copy -ovc copy INPUT.FILE -o OUTPUT2.FILE -ss VALUE

Both of the files, INPUT & OUTPUT are mpeg files

This will create a MPEG file ready to be either watched or converted again into the VCD format and then burned.

Hope that helps, and this also servers as a reminder to me 🙂

How to convert AVI-MPEG to DVD

This shall serve as a reminder for myself and may help others. The software that I have used is

To convert the avi file into a mpeg file for a PAL 352×288 screen, there is different settings either use the ‘man’ or goto the Transcode website for viewing the conversion in more detail. The command line that I use is

  transcode -i<AVI FILM> -V -y mpeg -F d -E 44100 -b 224 -fps 25 -o <OUTPUTFILENAME>

This generates two files, *.m2v (the dvd video segment) and *.mpa (the audio segment).

The options in the above command line are

  • -b Audio bitrate Kbit’s
  • -E Audio sampling rate (Hz)
  • -F codec (d = dvd)
  • -i input file
  • -V use internal video codec (faster but some import modules do not support this)
  • -y video, audio export modules.
  • -fps Frames per second, 25 is for PAL, 29.97 for NTSC

If the audio is in the AC3 Codec then you may need to reduce the bitrate for encoding. This is done with a profile file dvd.prof, which containts the following entry.

   max_bitrate=4000000.0

this will reduce the bitrate to 4000 kpbs. The profile is passed to the transcode program within the 3rd parameter to -F, also the parameter -A means to use the internal AC3 codec.

  transcode -i<AVI FILM> -V -y mpeg -F d,,dvd.prof -m <OUTPUTFILENAME.AC3> -A 0x2000 -fps 25 -o <OUTPUTFILENAME>

Joining the OUTPUTFILENAME’s together

To join these two segments together

  tcmplex -o <OUTPUT.VOB> -i <OUTPUTFILENAME.M2V> -p <OUTPUTFILENAME.MPA> -m d

If using the AC3 codec then

  tcmplex -o <OUTPUT.VOB> -i <OUTPUTFILENAME.M2V> -p <OUTPUTFILENAME.AC3> -m d

This will create a MPEG file ready to be either watched or converted again into the DVD format and then burned.

Hope that helps, and this also servers as a reminder to me 🙂

How to convert DVD to AVI

The program required to change a DVD to AVI format is called “transcode”, below is a link to the homesite and also a link to any rpm’s that have been build and lurking on the RPM-FIND

Usually the first block of the DVD is the whole, or if not a big part, of the movie thus would be better to do a test run on the second block. The second block is tested by using the “-T 2” parameter. To ascertain the bitrate/information from the DVD for the conversion the command line is ( I am assuming that the DVD in mounted on /dev/dvd)

     
tccat -t dvd -T 2,-1 -i /dev/dvd | tcextract -x ac3 -t vob | tcdecode -x ac3 | tcscan -x pcm

tccat parameter’s

  • -t Type of input
  • -T Title/chapter
  • -i Input device

tcextract parameter’s

  • -x Codec
  • -t Source file format (vod = mpeg stream)

tcdecode parameter’s

  • -x Codec

tscan parameter

  • -x Codec

The tccat program places the dvd media onto the standard output for the 4 pipping command line. The tcextract extracts from the standard output (the output from tccat) and extracts/demultiplex the stream and places the output back onto the standard output for the tcdecode program. The tcdeocde converts the output
from the tcextract pipe into the raw format for the tcscan program to display the different aspects of the output stream and displays the results on the standard output(the console).
The tcscan program displays information about the video and also the audio. The audio information includes the audio gain that is required for the conversion so that the audio is not to low/loud :).

To run a conversion test on the second block (“-T 2”) for converting into the divx5 format and also testing the audio gain, the audio gain from the above tcscan is placed into the parameter “-s”.

transcode -i/dev/dvd -x dvd -T 2,-1 -V -B 1,0 -Y 76,8 -s 2.340 -t 83920,dvd1 -y divx5 -w 1618 

and then finally the film

transcode -i/dev/dvd -x dvd -T 1,-1 -V -B 1,0 -Y 76,8 -s 2.340 -t 83920,dvd1 -y divx5 -w 1618

transcode parameter’s

  • -i Input device
  • -x Video input module
  • -T Title/Chapter
  • -V YUV internal encoding
  • -B resize n,m,M (M = 8,16,32) height = n * M, width = m * M
  • -Y Select encoder clipping border
  • -s Audio gain
  • -t (n,base) Split the outputted film into frames (n) with base name (base)
  • -y Video export module
  • -w Encode bitrate

Hope that helps, and this also servers as a reminder to me 🙂