Application Topic
   >  Screen Capture using KDEnlive
   >  Using RecordMyDesktop
   >  Using Istanbul
   >  Using FFMPEG

 

Using FFMPEG to Capture your Screen

Introduction to the FFMPEG Utility

ffmpeg is a utility normally used to transform files into MPEG format. However, it can also be used to capture the action on your screen - and record this to disc in MPEG format.


Installing FFMPEG

Many distros include ffmpeg as standard but it can be installed from the command line for Ubuntu by typing:

sudo apt-get install ffmpeg

For Fedora, it can be similarly be installed using the command:

sudo yum install ffmpeg

Note: that you may have to enable an additional software repository first in order to locate this - e.g.

sudo rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm

You can also search your Software Centre for it and install it from there!


Running FFMPEG from the Command Line

ffmpeg can be run from the command line using the command:

ffmpeg -f x11grab -s <Screen Resolution> -r <Frame Rate> -i :0.0 -qscale <Quality 1-5> <Output Filename>

For example:

$ ffmpeg -f x11grab -s 1280x800 -r 25 -i :0.0 -qscale 5 screenGrab.mpeg
ffmpeg version git-snapshot-oldabi-20110612-RPMFusion, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jul  1 2011 17:42:31 with gcc 4.6.0 20110509 (Red Hat 4.6.0-7)
  configuration: --prefix=/usr .... --enable-runtime-cpudetect
  libavutil    50. 41. 0 / 50. 41. 0
  libavcodec   52.121. 0 / 52.121. 0
  libavformat  52.108. 0 / 52.108. 0
  libavdevice  52.  4. 0 / 52.  4. 0
  libavfilter   1. 78. 0 /  1. 78. 0
  libswscale    0. 14. 0 /  0. 14. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[x11grab @ 0x9ccea60] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1280 height: 800
[x11grab @ 0x9ccea60] shared memory extension found
[x11grab @ 0x9ccea60] Estimating duration from bitrate, this may be inaccurate
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1328611999.165232, bitrate: 819199 kb/s
    Stream #0.0: Video: rawvideo, bgra, 1280x800, 819199 kb/s, 25 tbr, 1000k tbn, 25 tbc
Incompatible pixel format 'bgra' for codec 'mpeg1video', auto-selecting format 'yuv420p'
[buffer @ 0x9cbe220] w:1280 h:800 pixfmt:bgra tb:1/1000000 sar:0/1
[ffsink @ 0x9cbe300] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x9cdbf40] w:1280 h:800 fmt:bgra -> w:1280 h:800 fmt:yuv420p flags:0xe2000004
[mpeg @ 0x9cbe440] VBV buffer size not set, muxing may fail
Output #0, mpeg, to 'screenGrab.mpeg':
  Metadata:
    encoder         : Lavf52.108.0
    Stream #0.0: Video: mpeg1video, yuv420p, 1280x800, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=  145 fps= 25 q=5.0 size=    2924kB time=5.76 bitrate=4158.6kbits/s dup=7 frame=  158 fps= 25 q=5.0 ... 0.405580%

When you want to stop recording, simply hit q in your command line window to stop the process. Any action on your desktop inbetween running ffmpeg and hitting "q" will be recorded in MPEG format in the output file that you specified. This file can then be played back using your favourite media player or uploaded to the web as desired.

Note: you can explore the available command line options by typing man ffmpeg at the command line


Further Reading:


HomeSite IndexDesktop GuideServer GuideHints and TipsHardware CornerVideo SectionContact Us

 sitelock verified Firefox Download Button