Linux Video Exporting tutorial.

by Lars Georg Paulsen @ Braindead Production

Last Updated; 26th April 2006

A remake of my simple quick tutorial, that I made for myself so that I had
a place that I could Copy&Past code from when I needed to export movie clips
from Cinelerra to different formats.

I had to do a remake of this tutorial, cause my old one didn’t work anymore.
There where some changes to transcode, so when I used my old pice of code, it couldn’t read my source file coming from Cinelerra

Just do make it clear, All my photage is in HDV format, imported to my computer trough
down converting it to normal SD pal. It’s in 16:9 format, so if you do have some other format, please
be carefule when you doing enconding, the make the format fit your needs.

Table Of Content;

Exporting your work from Cinelerra
Result used in every ex below

Exporting to DVD
Encoding with Mencoder
Making DVD structure
Making ISO image

Exporting to XviD
Encoding with Mencoder

Usefule Links for more reading
Disclaimer

Exporting your work from Cinelerra

Scenario; You have imported, edited your video, added transisions, effects etc and
now you want to export your work. First you have to mark everything, this is done by
holding down ‘Ctrl’ and pressing ‘a’, You have to do this otherwise it will not export everything.

The next step is exporting. In Cinelerra it’s not called exporting, it’s called rendering.
Go to the ‘File’ meny and find the option ‘Render…” You can use shortcut key, ‘Shift+r’. An option popup
window will be displayed. (fig 1)


fig 1

Check if the settings are right.

Select a file to render to: This is where you want to place your rendered file
File Format: Here you want QuickTime For Linux – best quality (big files)
Audio: Most be marked for rendering
Settings for Audio should be; Twos Complement, 16 Bit Linear (not Dithered)
Video: Most be marked for rendering
Settings for Video should be; Compression: DV

The Rest should be like the pictures (fig 1)

Exporting to DVD

After exporting your work from Cinelerra, you should have a file called YourMovie.mov
So here comes the converting part, this takes some time, if you have large movie.
A quick tip should be, only export a small preview of your movie, to check out quality etc

Here we use to use transcode but since I’v had so much trouble
with it, and haven’t found out a workaround, I’v started to use mencoder
It’s very powerful, and because it’s a part of mplayer, it can read almost very format out there, and export to a lot aswell.

Mencoder

mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835: vrc_maxrate=9800:vbitrate=5000: keyint=15:acodec=ac3:abitrate=192:
aspect=16/9 -ofps 25 -o $YourMovie.mov $NewMovie.mpeg

Option; Comment;
-oac lavc -ovc lavc This says witch codec to use for video (-ovc) and for audio (-oac)
-of mpeg -mpegopts format=dvd You can control the output format. Using these options we can instruct it to create the correct type of file.
-vf scale=720:576,harddup Setting up Video Filters (-vf). Scaling movie to 720×576(PAL), Harddup forces duplicated frames to be encoded in the output.
-srate 48000 -af lavcresample=48000 Is used if the orignal format does not have the proper audio sample for the media you are creating.
-the rest Rest will come later

Making DVD Structur

Get a copy of dvdauthor, and run this
simple comando too create a dvd structure in folder

dvdauthor -o $DVD $NewMovie.mpeg

Change $DVD to a catalog names, it doesn’t need to exist.
Change $NewMovie.mpeg to your movie filename.

If you are adding more video to this dvd, repeat the step above, if not you have to create
the content table, this is done by running the below command.

dvdauthor -o $DVD -T

Where $DVD is the folder you used before.

Making DVD-ISO file

This is also very simpel, use a program called mkisoft
mkisofs -dvd-video -udf -o dvd.iso DVD

Exporting to XviD

If you mission is to export to a high quality, small file formate, XviD is a good choice.
Maybe later the h.264 will take over, but for now XviD is a very good choice.
When I release movie from BrainDead Productin, I realease them in three differen sizes, depending on file size and quality.
The smallest is good for those who doesn’t have broadband etc, and the highest is for those how does.
The encoding process is a 2-phase encoding, to make it as good as it can get. Play around with the options, and
find out witch one is most suited for your use.

Mencoder

Instead including three almost identical, I’v used one big line of code, and you can just put in the optinos from the table
below so that you get the quality you want. There is also to other variables you need to change so that they fit your content.

mencoder $Movie.mov -ovc xvid -xvidencopts bitrate=$Bitrate:pass=$phase:quant_type=mpeg -aspect $aspect
-oac mp3lame -vf crop=$crop -lameopts abr:br=$arate -o $OutputMovie.avi

Use the below options to define your quality.

$bitrate $crop $arate
High Quality 2000 720:432 128
Medium Quality 600 360:240 128
Low Quality 300 180:120 64

There are two more variables you need to change; $phase and $aspect.

$phase
This one is to define witch phase your on. You have to run the code above twice to get a 2-phase encoding.
That means that in the first run, $phase should be 1 and when you run 1. phase without errors,
you run it again, but then change $phase so that is 2

$aspect
To use it with the $crop options above, you need to set $aspect to 16:9, if your content
is in 4:3 format, you need to change both $aspect and $crop option. You can play around with both these
options, but mencoder may fail, if you use $crop and $aspect options that doesn’t fit together.

http://www.ftconsult.com/twiki/bin/view/Cinelerra/Rendering
http://www.gecius.de/linux/dvd.html
http://www.linuxmedialabs.com/Docs/LML33-NLE.html
http://www.kerklied.com/adrie/presentatiedvdmakeneng.html
http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-vcd-dvd.html

Disclaimer

I take no responsibily, of what might or can happened to your system, while using this tutorial,
I’m no wizzard in linux or video editing, the information found in this tutorial is purely based on own experience
and information found on the www.

There is probably a lot that I’v forgoten, so feel free to fill me in on things that might need to be updated,
and suggestion that this tutorial is missing.

If you have any trouble using this tutorial, please feel free to email me.
Lgp [a] braindead.nu