LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 05-15-2011, 12:36 PM   #1
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,244
Blog Entries: 6

Rep: Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880
Screencasting with ffmpeg tutorial


Screencasting with ffmpeg in FreeBSD and Linux. Use your own OS syntax.

Example: If you want the whole desktop, at 24fps, with sound, to output.avi
Code:
ffmpeg -f oss -i /dev/dsp0.0 -f x11grab -r 24 -s 1024x768 -i :0.0 output.avi
Example: If you want the desktop with raw audio, x264 video at 30 fps to output.avi
Code:
ffmpeg -f oss -i /dev/dsp0.0 -f x11grab -r 30 -s 1024x768 -i :0.0 -acodec pcm_s32le -vcodec libx264 -vpre lossless_ultrafast output.avi
Example If you want a screen area captured with 128k mp3 audio, and 1000k 30 fps mpeg4 video to output.avi, qscale n will be more or less CPU intensive with resulting better or worse video
Code:
ffmpeg -f oss -i /dev/dsp0.0 -f x11grab -r 30 -s 410x230 -i :0.0 -acodec libmp3lame -ab 128k -vcodec mpeg4 -b 1000k -qscale 10 output.avi
If you want to find the size and offset of a particular window to capture
Code:
xwininfo
Then enter that info after the :0.0 in format +30,25

Example: A video window in a web browser captured at 30 fps, raw audio, x264 vid, to ouput.mkv
Code:
ffmpeg -f oss -i /dev/dsp0.0 -f x11grab -r 30 -s 416x234 -i :0.0+35,86 -acodec pcm_s32le -vcodec libx264 -vpre lossless_ultrafast output.mkv
You'll need to have ffmpeg compiled with libmp3lame, libx264, mpeg4 or whatever it is that you are wanting to use, faac, faad, matroska......

The capturing of video is faily CPU intensive. You'll need a box with some hoursepower if you want to capture videos of any major size.

It also depends on how active the screen is that you are capturing. You can capture an xterm full screen as you type with audio from your mic without stressing the CPU much. (Turn up your mixers record input).
Capturing a flash video as it plays will require more horsepower.

For example: I tried it on a older P4 2Ghz. box with onboard AGP video, and trying to capture videos much past a resolution of around 600x350 would peg the CPU 100% and result in ffmpeg dropping to 8-10 fps capture rate. the videos captured would still play but were quite jerky and missing video as you would imagine.

Oh, and this FreeBSD box uses oss and /dev/dsp0.0 as its sound device. Use your own device and sound system. If you have a multi core box then -threads will help things up too. Linux may use pulse or just alsa, and /dev/dsp0
Code:
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 1024x768 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 2 output.mkv
The less you encode while capturing the better. You can re-encode the video later after you have it.

Hopefully this is of some use to someone.
 
Old 05-15-2011, 05:35 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,244

Original Poster
Blog Entries: 6

Rep: Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880Reputation: 1880
You can also get your screen size with
Code:
xwininfo | grep -e Width -e Height -e Absolute
Then click on a window or the desktop.

You can also hide the mouse cursor
Add +nomouse after :0.0 to look like this: :0.0+nomouse

Someone suggests
Code:
xrandr --prop 2> /dev/null | awk '/\*/ {print $1}'
For screen size

Last edited by teckk; 05-15-2011 at 05:37 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: 2 Linux Screencasting Applications LXer Syndicated Linux News 1 12-16-2010 09:53 AM
Screencasting on Linux prudens Linux - Newbie 5 08-12-2009 01:34 PM
LXer: 6 of the Best Free Linux Screencasting Software LXer Syndicated Linux News 0 07-24-2009 11:50 AM
LXer: Screencasting with Linux LXer Syndicated Linux News 0 03-19-2007 07:31 PM
LXer: Screencasting Linux LXer Syndicated Linux News 0 08-04-2006 05:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 02:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration