Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: encode video for helix server (ie realplayer)
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message

Joined: 20 Mar 2004
Posts: 217
Location: sydney, .au

PostPosted: Mon Oct 31, 2005 3:41 am    Post subject: HOWTO: encode video for helix server (ie realplayer) Reply with quote

I've got a helix server running on a computer here. it's surprisingly efficient once you work out the commandline stuff. I often do live streaming from an old laptop using helixproducer under windows (also pretty simple once you work out the commandlines). I might include more about that later, but this howto is about:

encoding video
from a firewire camera (or any other source)
to realplayer's streaming video format (.rm)

dvgrab (if your video is in a camera)
mplayer (with 'encode' in your use flags so you can use mencoder)
real producer (i'm using real producer basic, but you get more features if you pay US$200 for Real Producer Plus, and more cutting edge if you use the versions from the helix community site
realplayer or helixplayer

it costs about 25Gigabytes to do this whole process in one go. you can delete nearly all of that after you've finished, or you can do a bit more work to delete every large file as you compress it.

make yourself a new folder to work in.



Grab video from a mini-DV camera connected by firewire
The easy way to cut this whole howto down to one line would be to work out how to get real producer to capture video straight from the camera. I can't work it out though, so here we go:

dvgrab has always worked flawlessly for me - to grab a whole one hour tape:
dvgrab --duration 60:00

that will give you a folder full of 1 megabyte files like this:
dvgrab-001.avi dvgrab-003.avi dvgrab-005.avi dvgrab-007.avi dvgrab-009.avi
dvgrab-002.avi dvgrab-004.avi dvgrab-006.avi dvgrab-008.avi

encode the dv file to uncompressed i420 avi
real producer for linux only works on uncompressed files (that's why you need all those gigabytes). so we have to use mencoder to uncompress the dv file. since the final realaudio file will be pretty compressed, i save some time and space here by scaling the video down.

mencoder -o FILENAME.avi -ovc raw -vf format=i420  -vf scale -zoom -xy 320 -oac copy ORIGINALDV.avi

What does that all mean?
well it takes ORIGINALDV.avi as the input file and creates a file called FILENAME.avi, with these settings:

-ovc raw -vf format=i420
decompresses the avi and turns it's colours around so that they're in the format realplayer likes
-vf scale -zoom -xy 320
scales the video down to 320x288 (only specifying the x resolution makes it keep the original
-oac copy
uses the original audio from the dv file

we aren't working with just one file though, we've got all those dvgrab-001 files to work with.
if you specify them individually on the commandline, or with a wildcard (replace ORIGINALDV.avi with dvgrab*) the output file will be one huge avi. but it is a bit too big. i didn't have any luck getting realproducer to work with a large avi, and if you find a glitch later on you have to back up a lot further. so i wrote a little script like this:
for i in `ls dv*` ; do mencoder -o  NEW$i -ovc raw  -vf scale -zoom -xy 320 -vf format=i420 -oac copy $i ; done

now we have a folder like this:
dvgrab-001.avi dvgrab-004.avi NEWdvgrab-003.avi
dvgrab-002.avi NEWdvgrab-001.avi NEWdvgrab-004.avi
dvgrab-003.avi NEWdvgrab-002.avi

encode the files for realplayer
finally, use real producer (or helix DNA producer) to encode the avi's to rm:
producer -i FILENAME.avi -ad 128k -am music

that takes a file named FILENAME.avi,
-ad 128k
compresses it for a 128k stream. for higher quality try
-ad 350k\ D
which selects the "350k Download (Variable Bit Rate)" encoder
-am music
makes the sound higher quality at the expense of the video.

if you pay money for the "Plus" version of realplayer, you can do stuff like putting multiple files or wildcards on the commandline. us paupers have to use scripts - but i'll come back to that.

You might get warnings about the audio clipping - that's ok. if you get any Errors, your video will probably not work and you have to go back to the mencoder stage.

now you've got some .rm files, test them!
realplay FILENAME.rm

you don't want to stream a whole lot of little files though do you?
luckily real producer comes with a little utility to make them nice and neat:

rmeditor -i FILE1.rm -i FILE2.rm -i FILE3.rm -o FINALFILE.rm -t "My video title" -q "more information here"

Now the bit you've been waiting for:
I've written a line of code which does the whole lot automatically (well i hope so - i'm writing this howto while my hard drives crunch away)

dvgrab --duration 59:00  &&  for i in `ls dv*` ; do mencoder -o  NEW$i -ovc raw  -vf scale -zoom -xy 320 -vf format=i420 -oac copy $i  &&  producer -i NEW$i -ad 128k -am music ; done && for i in `ls *.rm`;do echo -n " -i "$i >> args  ; done  &&  rmeditor `cat args` -o FINALFILE.rm -t "My video title" -q "more information here" ; rm args

yep, it worked.

upload the file to the Content folder of your helix server installation, and give the address as
then watch your access log to see whether anyone actually watches it...

my server isn't that stable, and neither is my musician, but today's work is here
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum