Making a DVD with your own digital video material
(under Mandrake 9.2 with Open Source software only)

Dutch version

Terug naar hoofdmenu

(Paper originally made for a presentation at the Hobby Computer Club - Amsterdam)
Last written: January 2th 2005

Stepping Stones:

1. Installing Firewire
2. Capturing and (basic) editing with KINO.
3. Editing with CINELERRA.
4. Rendering with CINELERRA, if you wish in a RENDERFARM
5. Pasting files with MPLEX or TCMPLEX.
6. Making DVD.ISO
7. Formatting DVD+RW disk
8. Burning DVD with GROWISOFS
9. Interesting links.

Ad 1. Installing Firewire.
 

Of course you need a Firewire port in your computer. If that port is not available on the mainboard, you will have to buy a Firewire card and put it in a free PCI slot.

After that you have to load the necessary drivers. For downloading the drivers look under point 2.
For activating the drivers you can use the following script 'firewirestart.sh':

#!/bin/sh
#Script for loading the IEEE 1394 modules

modprobe ohci1394
modprobe raw1394
modprobe video1394
echo "Firewire modules installed!!"

You make the file executable (chmod +x firewirestart.sh) and when you start it (as root) the drivers are loaded.

If you want the drivers automagically loaded at the startup of the computer, you can add the next few lines to the file /etc/modules:

ohci1394
raw1394
video1394

You write the lines as root and after each computer startup the drivers will be loaded.

Top

Ad 2. Capturing and (basic) editing with KINO.
 
You can download KINO at http://kino.schirmacher.de where you can find other helpful software as well. Just read things through and install the rpms as described there.

After that make sure the firewire modules are loaded and start KINO as root.

At first you arrange the 'Preferences' and take care that the correct data are put in the right places. Below you see the first three tabs. All the rest of them are default, but of course you can adapt them to your own wishes.

Defaults -
Normalization
PAL
Audio
48khz Stereo
Aspect Ratio
4:3

Capture -
Filename
Fill in
File Type
Quicktime DV
Other File Options
Auto Split Files
Put Timestamp in File Name

IEEE 1394
Driver DV Capture
/dev/raw1394
Driver DV Export
/dev/video1394/0

Put the camera in VCR mode and make sure there is a firewire cable connection between camera and computer.
Then you activate the tab Capture in the main screen of KINO.
Enter a filename and push the button AV/C.
With that button you hand over activation of the camera to KINO.
Then you click the button Capture and capturing will start.
In Preferences/Display you can arrange whether or not you want the captured frames shown on the screen.

If you have arranged Preferences/Capture as mentioned above the video will be written in a series of .mov files, that will all contain a new scene and that will have names with a date-time number.

After capturing is ready, you can see on the main screen next to the tab Edit what scenes you have pulled into your computer. It will probably take a little while before KINO has put the list on the left of the screen. Every new scene is represented there by a thumbnail of the first frame. You can save the whole setup of the movie by clicking File/Save Smil. A little text file is made then in which the order of the .mov files is mentioned. For new edits you only have to load the SMIL file.

You can do a lot of (basic) editing in KINO.
At the tab Edit you can cut out scenes, that are either useless or redundant.
You can also change the order of the scenes by cutting and pasting. You just activate a scene (=thumbnail), cut it, put the cursor elsewhere in the list of scenes and paste it back in again.
At the tab Trim you can look at every scene on itself and edit it by cutting out parts that you don't want to use. You just activate the buttons 'in' and/or 'out'. The part you want to see is kept between the two buttons.

All editorial activities so far only have effect on the SMIL file. The original .mov files remain unchanged. When you are finished making changes you can materialize them by exporting them to a new set of .mov files. As you can imagine you can organize that at the tab Export. Just fill in a new base filename and export the files as Quicktime .movs. If you leave the base name unchanged, you overwrite the old files.

You have now a series of .mov files that can be loaded into CINELERRA without problems.

Top

Ad 3. Editing with CINELERRA.

You close KINO and start CINELERRA.
You can download CINELERRA at http://heroinewarrior.com/cinelerra.php3 where you can get extra software as well. Just carefully read and carry out the descriptions. Installation of CINELERRA should be easy then, at any rate under Mandrake 9.1! Under Mandrake 9.2 you need to install the XFree86-compat-libs .rpm as well.

About using CINELERRA under KDE some extra remarks:
You have to arrange the properties of the CINELERRA icon in such a way, that CINELERRA is executed in a terminal window and can only be opened by root. You will find out that you cannot 'render' if you try any other way of installing the program, which obviously would render CINELERRA rather useless.
Furthermore you should check at the first time you start CINELERRA, if the data in Settings/Format match the things you want. For DVD quality audio e.g. the samplerate should be at 48000. And if you do not live in the States (which is the case for most of us ;-) ... ) you will probably want a video frame rate of 25.0000.

CINELERRA consists in fact of four programs, that are all active at the same time: Program, Viewer, Resources and Compositor. You can show and hide the programs through the menu Window in the mainprogram 'Program'.
The purpose of the main program is: showing the process of the building of the movie and the effects that are added to it. The Viewer shows (as you can easily deduct from the name) the videos you imported. The Resources department shows the videos you can import in the movie and the effects you can add to them. And the  Compositor finally shows the combination of the video fragments and the effects you have added: the result of you efforts ...

Importing video files goes as follows:
In the main program you click File/Load Files and in the directory of your choice you activate all  .mov files you want to import in CINELERRA. In the 'Insertion strategy' pull down menu you choose 'Create new resources only'.
After clicking OK all these files will appear by name or icon (depending on your choice) in the Resources window, in the directory Media.
Note:
Immediately after importing the videofiles Cinelerra will make a series of indexfiles in the directory /userdirectory/.bcast (in our case  /root/.bcast/). Especially if there is quite a number of videofragments (as is often the case) the total size of the indexfiles can grow rather big until even 1 Gb or more. If the .bcast directory is too small for that, you will not get a warning, but all kinds of things (like loading a backup after a crash!) will go wrong.

Building your video movie goes as follows:
You activate the Viewer window and drag the first .mov file there. With the left text hook '[' you mark the starting point of the import. With the right hook ']' you mark the point where you want the import to stop. After that you press the button 'Splice (v)' and thus you import the video in the mainscreen. You continue to do so until your movie is complete.
If you want to import a clip fully, you just drag & drop it from Resources/Media into the main screen.

In CINELERRA you can also add special effects:
You add a title by choosing Video effects in the Resources window and dragging the word 'Title' to the video track where you want your title to appear. With the mouse you can lengthen or shorten the time it appears on the screen. By right clicking over the word 'Title' you get a popup menu where  you can add and manipulate text through the option 'Show'.

In the same 'drag and drop' way you can add all kinds of other effects. Find it out by 'trial and error'.

Adding your own soundfiles.
For adding soundfiles you can use the commands I describe herafter:
To record a text, spoken into your microphone, in a .wav file, you use the command below. As you can deduct from the last option the recording has a frequency of 48 Khz.

rec -s w -c 2 -r 48000 <speech>.wav

With the next command you can record a track of a cd in a .wav file. In stead of <tracknumber> of course you fill in the actual tracknumber that you want to record.

cdparanoia -<tracknumber> <music>.wav

Because the frequency of the cd probably is not 48 Khz, you can correct that with the following line:
 
sox <music>.wav -r 48000 <newmusic>.wav resample

Pasting in soundfiles is simple. You import the files as mentioned above where I described importing video files. Next you arrange for two extra audio tracks in your project through the menuchoice Audio/Add Track. Then you put the cursor (the long, flashing line) exactly on the spot where you want the soundfile to fit in. After that you activate (in the Resources window) the soundfile and push the right mousebutton. In the popup menu that appears, you choose Paste and the file is pasted in at the right place. (Pasting in video files works exactly the same!)
The packages 'sox' and 'cdparanoia' are standard in the Mandrake 9.1 distribution. But you can also easily find them through http://www.rpmfind.net.

Note.
It is rather important to realize that CINELERRA is not really stable yet. Quite unexpectedly the program can just collapse. So do save your actions now and then through the File/Save or the File/Save Backup button.
If it ever happens to you, that CINELERRA suddenly disappears, you have not lost all of your efforts. After every change you make in the program CINELERRA automatically makes a backup. Through the option File/Load Backup after a restart you can get your last efforts back. But do not do anything else after restarting the program or you will have lost your earlier edits!

Top

Ad 4. Rendering with CINELERRA, if you wish in a RENDERFARM.

Then comes the rendering ... This is a process in two parts, that will take quite a lot of time.
So before you start you better FIRST press the option File/Save and/or File/Save Backup!
After that it goes as follows:
You choose the option Edit/Select All and thereafter the option File/Render. In the window that pops up you can fill in the name of the file you are going to create and the format it will be written in. At first you choose the MPEG VIDEO format and give the filename an .mpv extension. You put a mark only at 'video' and you choose (through the wrench button) at the word 'Derivative' for MPEG-2 . The other settings can remain unchanged. When you are sure you made no mistakes, you press the OK button.
The program will now show the word 'Rendering ...', a few moments later followed by the expression ETA and a visualization of the duration of the process. Depending on the length of your movie and the capacities of your hardware that can take quite a while! You better start this part when you are going to bed anyway. Maybe CINELERRA will be ready in the morning!

Advice 1: when CINELERRA is once rendering, the program does not like to be stopped. If you nevertheless try to do that a popup window appears with the message that the program can't be stopped during rendering. Sometimes (e.g. if you did make a little mistake in typing the filenames) you cannot accept that. Just use 'Xkill' in that case to stop CINELERRA.
Advice 2: a .VOB file (= a video file on a DVD) bigger than 1 GB can be played on a DVD player, but not on a PC! So if you want your DVD to be playable on your PC ...
Advice 3: if you have a network in which one or more Linux computers are present, you can setup Cinelerra in a renderfarm. You have to pay attention to the following points:
#!/bin/sh
mount -t smbfs -o username=root,password=xyz123 //<computername>/<workdirectory> /<mountdirectory>
cinelerra -d <port>
echo "Cinelerra slave started and <mountdirectory> mounted!"
When the video part is finally rendered, you repeat the actions I described for the audio part of the movie. This time of course you choose MPEG AUDIO as filetype and you give the filename an  .mpa extension. You remove the mark near the word 'video' and put it at 'audio'. In the 'wrench window' you choose Layer II and 384 kbits per second. If all stands well you press the OK button.
The audio rendering will be a lot quicker than the video part. Depending on the length of your movie it nevertheless can take some time!
My first experiences tend in the direction of about 10% of the time for the video rendering.

Top

Ad 5. Pasting files with MPLEX or TCMPLEX.

Now you have a video file with the extension .mpv and an audio file with the extension .mpa.
You merge these files together to an .mpeg file with the well known program 'mplex'. You use the line written hereafter:

mplex -v 0 -f 8 <video.mpv> <audio.mpa> -o <videoaudio.mpeg>

Of course you fill in your own filenames ...

It is possible, that mplex cannot do the job. I once experienced that mplex complained about 'too many dropped frames' after which it just stopped. In that case you can also use the program 'tcmplex' (part of the 'transcode' package), that can perform better.
The syntax is as follows:

tcmplex -i <video.mpv> -p <audio.mpa> -o <videoaudio.mpeg> -m d

This process can also take some time, but it should be not more than some minutes ...
The transcode program is available at: http://zebra.fh-weingarten.de/~transcode/#downloads

Top

Ad 6. Making DVD.ISO.

When the .mpeg is finally ready you can work on with the script make-dvd.sh.
It is shown below:

#!/bin/sh

# We clean up unnecessary files
# and make the necessary directories.
rm -r dvd dvd.iso
mkdir dvd
mkdir dvd/VIDEO_TS

# We make a DVD image here.
# This part has been taken from the
# writedvd script that goes with the dvdauthor tools.
# At first the IFO file is made and the table of contents.
# Finally the image itself is made with 'mkisofs'
cp $1 dvd/VIDEO_TS/VTS_01_1.VOB
chmod u+w dvd/VIDEO_TS/*.VOB
cd dvd/VIDEO_TS
ifogen ../../$1 -o ./VTS > VTS_01_0.IFO
tocgen . > VIDEO_TS.IFO
(cd dvd/VIDEO_TS; for i in *.IFO; do cp $i `basename $i .IFO`.BUP; done)
cd ../..
mkisofs -dvd-video -udf -o dvd.iso dvd/

# Here we burn the DVD on a DVD+RW
# Leave the comment signs before the dvd+rw-format line
# if your DVD is already formatted and does not contain any data.
# Remove them if you must format the disk.
# Remarkably enough these lines also work with an Imation -RW DVD! (???)
# dvd+rw-format -f /dev/scd0
# growisofs -Z /dev/scd0=dvd.iso

# Burns a DVD on a DVD-RW
# Remove the comment signs if you use such a drive
# Check the devicenumber with 'cdrecord -scanbus'
# Unfortunately I did not manage to get this piece working ;-((
# dvdrecord -dao speed=2 dev=1,0,0 dvd.iso

The script is executed with the name of the newly made .mpeg file (e.g. ./make-dvd.sh videoaudio.mpeg).
In the script it is supposed that you have writing rights in the directory where the .mpeg file is residing. If not, you will have to arrange that.

As you see the script is executed up to the formatting of the DVD+RW. That part and the actual burning of the DVD is commented out.
I think it is better to take those last two steps manually, allthough that seems to be an internal contradiction (like a 'wooden iron').

By the way ... dvdrecord (in which ifogen and tocgen are packed) can be downloaded from http://www.redhat.com/swr/i386/dvdrecord-0.1.2-4.i386_dl.html.
The program mkisofs can be downloaded from http://www.rpmfind.net//linux/RPM/cooker/cooker/i586/Mandrake/RPMS/mkisofs-2.01-0.a18.2mdk.i586.html
And the programs dvd+rw-format and growisofs can be found at http://fy.chalmers.se/~appro/linux/DVD+RW/tools/

Top

Ad 7. Formatting DVD+RW disk.

Formatting the DVD+RW disk goes through the line:

dvd+rw-format -f /dev/scd0

At least: if your dvdburner is addressed by that devicename. Otherwise you have to adapt that part.

Top

Ad 8. Burning DVD with GROWISOFS.

The final burning is activated by the line:

growisofs -Z /dev/scd0=dvd.iso

Same remark about the devicename here.

And ready is my homemade DVD!!

Of course a lot of other things has to be done, like making chapters and menus and all that ...
And a lot more is to be told about and experimented with CINELERRA, that really is (what the Germans call) an egg laying wool and milk producing pig (Eierlegender Wollmilchsau) ... But at least you should be able to produce a bearable homemade DVD.

Note
I am sorry to mention here that the so produced DVD plays excellently in the DVD player(s) in my computer(s), but that it does not at all play well (it constantly suffers from 'hickups') in my standalone DVD player. I have a Finlux DVD-512 and I am still investigating whether this effect only appears in this type of player, or that it occurs on every standalone player.

Always in for (positive!) critics and add-ons!!

Top

Ad 9. Interesting links.

The links below are interesting, if you want to know more about Cinelerra and the use of it.
1. The Secrets of Cinelerra, documentation about the program: http://heroinewarrior.com/cinelerra/cinelerra.html
2. A clear userguide for Cinelerra: http://www.robfisher.net/video/
3. A short description about the making of SVCDs with Cinelerra: http://www.cornelinux.de/linux/videos/videoschnitt.html
4. Two interesting URLs I was recently told about: http://cvs.cinelerra.org and http://manual.cinelerra.org

Top

Adrie van der Heijden
HCC-Amsterdam
agheyden@dds.nl