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 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 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 Code:
xwininfo 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 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 Hopefully this is of some use to someone. |
You can also get your screen size with
Code:
xwininfo | grep -e Width -e Height -e Absolute 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}' |
All times are GMT -5. The time now is 06:53 PM. |