Guide/Discussion on recording the desktop and compressing video in Linux.

Last updated on 15 years ago
G
Ok, I want to be able to record the desktop in Linux, for emulators and
maybe native Linux games.
If anyone has information about this please tell me.
This is what I've found so far:
Lossless recording:
Slow:
ffmpeg -f x11grab -s 252x240 -r 50 -g 30 -sameq -i :0+5,25 -vcodec ffv1 -an megaman.mov

-f x11grab - option to record from the desktop
-s 252x240 - sets the screensize
-r 50 - refresh rate (frames per second to record)
-g 30 - don't really know. Means GOP group of pictures i think.
-sameq - don't know if it's necessary
-i :0+5,25 - from what screen to record from, +5,25 is the offset on the specified screen. can be :0.0 also?
-vcodec ffv1 - this option chooses a lossless video codec (convert later to reduce size)
-an - disable sound recording, haven't got sound recording to work yet.
megaman.mov - this is the output filename.

Faster (Faster than ffv1)
ffmpeg -f x11grab -an -s 640x400 -r 30 -i :0+5,25 -vcodec ffvhuff megaman.mov

Don't know how to record the sound, maybe I'll figure it out later and write it here.
If anyone has info about this, please share to complement this maybe.

Compression:
ffmpeg -i megaman.mov -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 1M -bt 1M -threads 0 megaman.mp4

-i megaman.mov input file
-an disable audio recording (is this necessary?)
-pass 1 select the pass number, ?? don't know. (1 or 2 are valid).
-vcodec libx264 use x264 video encoder (the output file's encoding)
-vpre fastfirstpass See ffmpeg's man page or documentation for -vpre (It's for using preset (configuration) files). See links for getting these files.
-b 1M Bitrate in bit/s. 1 megabit/second here. M means Mega. K means kilo.
-bt 1M Bitrate tolerance, don't know much about this.
-threads 0 let ffmpeg choose how many threads to use.
megaman.mp4 output file

If it dosen't work, see:
x264 encoding guide
x264 encoding, ffmpeg presets
(Use the presets from the official release instead of from the page above. Download link.)


Haven't tested fullscreen. You can use xrandr to change resolution to 320x240, 400x300 640x480 or whatever, to get larger screen. (I think it only works with Radeon cards as of April 2009).

For more info on lossless copmression codecs:
Lossless codec copmarison
And:
Wikipedia comparison of video codecs.
You can view all discussion threads in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You cannot download attachments in this forum.