Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

How to grab the desktop (screen) with FFmpeg

A collection of useful tutorials for some common tasks.

How to grab the desktop (screen) with FFmpeg

Postby burek » Mon May 07, 2012 9:21 pm

Linux

Use the x11grab filter:
Code: Select all
ffmpeg -f x11grab -r 25 -s 1024x768 -i :0.0+100,200 output.flv

This will grab the image from desktop, starting with the upper-left corner at (x=100, y=200) with the width and height of 1024x768.

If you need audio too, you can use this:
Code: Select all
ffmpeg -f x11grab -r 25 -s 1024x768 -i :0.0+100,200 -f alsa -ac 2 -i pulse output.flv


Windows

Use the dshow filter:
Code: Select all
ffmpeg -f dshow -i video="UScreenCapture" output.flv

This will grab the image from entire desktop.

If you need audio too, you can use this:
Code: Select all
ffmpeg -f dshow -i video="UScreenCapture":audio="Microphone" output.flv


You can list your devices with:
Code: Select all
ffmpeg -list_devices true -f dshow -i dummy


General note
If you have a slow computer, it will not be smart to grab and encode your video at the same time, because slow CPU will not be able to do this. In that case, first grab all you need and save it as uncompressed video/audio and when you finish the grabbing process then start converting it to whatever you need:

Linux:
Code: Select all
ffmpeg -f x11grab -r 25 -s 1024x768 -i :0.0+100,200 -f alsa -ac 2 -i pulse -vcodec libx264 -crf 0 -preset ultrafast -acodec pcm_s16le output.flv
ffmpeg -i output.flv -acodec ... -vcodec ... final.flv


Windows:
Code: Select all
ffmpeg -f dshow -i video="UScreenCapture":audio="Microphone" -vcodec libx264 -crf 0 -preset ultrafast -acodec pcm_s16le output.flv
ffmpeg -i output.flv -acodec ... -vcodec ... final.flv
burek
 
Posts: 864
Joined: Mon May 09, 2011 10:16 pm
Location: Serbia

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests