November 25, 2010

Howto create a video with Linux and publish it on YouTube


This time I'd like to share with you a simple method for creating a screen cast, adapt it to a common format and finally publish your job to YouTube or another web video sharing service. In my everyday job I need to create documentation and a video is something simple, direct and easy to understand for everyone.

Publishing some videos has never been so easy if you work with a Linux workstation, this is a step by step guide for the average Linux user.

One of the simplest program around for recording screen casts is “RecordMyDesktop”, if you use Gnome you've gtkrecordmydesktop, on KDE there are qt-recordmydesktop and recordmydesktop-kde, by the way, it doesn't matter which version you're using, when you start it you'll have a tiny window like this:



Basic Settings

In my example I'll record a GEDIT session, but before selecting the full screen or the targeted window let's check the advanced settings to see my changes, just press “Advanced” button to see something, here's what I've changed:


in the “Performance” tab I've setup a low frame rate because I'm recording just desktop applications, I've disabled “Encode on the fly” and enabled “Zero Compression”.

With these settings even if you've a low end computer you'll have a quite decent video and audio, my first big problem with RecordMyDesktop was related to audio or video out of sync, with a setting like that you'll waste a lot of space but at least you've a well formed audio/video stream; you'll process your video later to adjust size and various optimizations.

Let's record something...

Resize your window to meet your needs and press the “Record” button and do something with your app, when you're done just press “Stop” in the top right corner where RecordMyDesktop resides (Gnome App for me...).

If you're a command line guru and you prefer to use a script or something like that you can run a command like this:

recordmydesktop --width=1024 --height=768 -x=10 -y=50 --overwrite -o out.ogv

This starts RecordMyDesktop with a 1024x768 window located starting from X=10, Y=50 from the top left, so I can place my app in that position and cut my Gnome menu bar, this is what I do for recording web screen casts, “overwrite” wipes existing out.ogv (default output file) if any. Take a look at the man page for further details. If you're using the command line directly you need to hit Ctrl-C to stop the recording.

Process your video

Now it's time to process your video and encode it in a well common format, if you upload videos on YouTube you can upload basically everything you want, from open formats like OGV, 3GP files from cellular phones, AVI files and so on. I've decided to convert my videos to AVI files and then upload them to YouTube, I just need to shrink my uncompressed video, resize it and convert into an AVI container. To achieve this task you can use one of these tools:


mencoder your.recorded.file.ogv -ovc xvid -oac mp3lame -xvidencopts
-vf scale=1024:768 -o your.recorded.file.avi


ffmpeg2theora --videoquality 10 --audioquality 10 -optimize -x 1024 -y 768
your.recorded.file.ogv -o your.recorded.file.avi


ffmpeg -threads 2 -i
your.recorded.file.ogv -f avi -r 29.97 -vcodec libxvid -vtag XVID -s
1024x768 -aspect 4:3 -maxrate 1800kb -b 1500kb -qmin 3 -qmax 5
-bufsize 4096 -mbd 2 -bf 2 -flags +4mv -trellis -aic -cmp 2 -subcmp 2
-g 300 -acodec libmp3lame -ar 48000 -ab 128kb -ac 2

All these commands resize an input video to a 1024x768 (HD) AVI file suitable for a YouTube upload. I personally prefer the third option and I always use ffmpeg heavily, command line options were taken from WinFF (ffmpeg GUI), I suggest to use it to avoid audio/video sync problems.

Adjust size to proper values if you need a different resolution, in my example I'm using 1024x768.


Now with your new AVI file you'll be able to upload it directly to YouTube without worries and having it quickly available without heavy post processing jobs from Google

Here's a sample.


News Update: Do you want to convert smartphone .3GP files to an AVI in the same way ? Read my "Convert 3GP to AVI (from smartphone to PC or YouTube)" blog []


Glad to receive your comments and add your tips to the command list as well



Click Here!