Saturday, September 22, 2012

How To Do Screen Casts In Linux




If you have an rpm-based OS, do :

Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. $ yum install ffmpeg

else if you have a debian based OS, do:

Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. $ sudo apt-get install ffmpeg


After the packages are installed,

Run the the following command for a screen cast (without audio):

Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. $ ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -qscale 0 /tmp/out.mpg

-f           ==  force format
x11grab ==  Grab the X11 display
-s          ==  size

 wxga    == 1366x768
-r          == set frame rate
-i           == in file

-sameq  == same quality

This will create a file out.mpg in the directory /tmp.

Run the the following command for a screen cast (with audio):

Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. $ ffmpeg -y -f alsa -ac 2 -i pulse -f x11grab -r 30 -s `xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -i :0.0 -acodec pcm_s16le my_output.wav -an -vcodec libx264 -vpre lossless_ultrafast -threads 0 my_output.mp4

-y   == Overwrite output files
alsa ==  ALSA (Advanced Linux Sound Architecture) input device
-ac  == set number of audio channels
-i    == pulse [Refers to pulseaudio]

`xdpyinfo | grep 'dimensions:'|awk '{print $2}'` == get the max resolution of your screen
-acodec == foce audio codec
-an == Disable audio recording
-video == foce video codec

This will create two files my_output.wav and my_output.mp4 in the current directory.

This correspond to the audio and video recorded.

To join combine the audio and video in a single file, just type:

Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. $ ffmpeg -i my_output.wav -i my_output.mp4 -sameq Output.mp4

The required video will be stored in Output.mp4

Update: In fedora, Ctrl + Shift + Alt + R -- Records a Screencast of your entire desktop and saves it to your Videos folder.

To detect crop dimensions:
ffmpeg -i in.mpg -vf "cropdetect=24:16:0" out.mpg
To crop video:
ffmpeg -i input.mpg -vf "crop=1280:768:43:0" -qscale 0 output.mpg
To change aspect ratio:
ffmpeg -i input.mpg -s 1366x768 -aspect 16:9 -qscale 0 output.mpg
To concatenate media files:
ffmpeg -f concat -i mylist.txt -c copy -qscale 0 out_.mpg
cat mylist.txt
file out1.mpg
file out2.mpg

No comments: