Make an HD Video on Linux


Hello!

First, install required libraries.

sudo apt-get install mencoder ffmpeg x264 python-gtk2 libasound2-dev libavcodec-dev libavutil-dev

Type this command into terminal, using the proper parameters (advanced).

ffmpeg -f x11grab -s 1920x1020 -r 30 -i :0.0 -vcodec libx264 -vpre lossless_ultrafast -threads 3 /home/jordan/v.mov

Otherwise, you can use this script, originally from Ondrej Certik’s git repository.

Clone the repo.

git clone git@github.com:JordanBlocher/record.git

Check out this branch.

git checkout -b newmode origin/newmode

Making the video.

In the terminal,

./record.py

will record audio and video.

Note. Audio no longer works with Cython 15.1.0+. No sufficient fix right now.

After the images have been generated, the two formats I like best are HD Quicktime using the x264 codec, and 2-pass mpeg4 using the lavc codec. In either case mp3 sound (libmp3lame) should probably be used, most browsers will play mp3 files.

HD Quicktime

No audio:

mencoder mf://PNG_FILE/*.png -mf fps=15 -ovc x264 -o v.mov

With audio:

mencoder mf://PNG_FILE/*.png -mf fps=15 -audiofile /PNG_FILE/audio.wav -oac mp3lame -ovc x264 -lavcopts -o v.mov

2-pass mpeg4

No audio:

    mencoder mf://PNG_FILE/*.png -mf fps=15 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=800:vpass=1 -o /dev/null
mencoder mf://PNG_FILE/*.png -mf fps=15 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=800:vpass=2 -o v.mov

With audio:

    mencoder mf://PNG_FILE/*.png -mf fps=15 -audiofile /PNGFILE/audio.wav -oac libmp3lame -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=800:vpass=1 -o /dev/null
mencoder mf://PNG_FILE/*.png -mf fps=15 -audiofile /PNGFILE/audio.wav -oac libmp3lame -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=800:vpass=2 -o v.mov

The new video file can be edited using openshot.

sudo apt-get install openshot blender

A shell script, replace, is included for frame-by-frame editing. It needs to be copied into the tmp directory to relabel the png files before using mencoder.

Recording Video Using Ubuntu 11.10 (Oneric Ocelot)


The python script has a lot of trouble with the unity desktop. The best solution I have now is to use the desktop recorder XVid Screen Capture from the Ubuntu software center. Installation and use is pretty straightforward. Use whichever codec is best for you, it supports most of them.

If you are having trouble with lost frames, then decrease the number of frames-per-second in the preferences. I am using 8 frames/second on my quad-core at home. This is not ideal, but the overhead of the program will not allow for more.






Table Of Contents

Previous topic

Math 181: Calculus I

Next topic

Code Development Using GitHub