Skip to content

Instantly share code, notes, and snippets.

@johnbartholomew
Created February 19, 2012 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnbartholomew/1866593 to your computer and use it in GitHub Desktop.
Save johnbartholomew/1866593 to your computer and use it in GitHub Desktop.
ffmpeg screen recording
#!/bin/bash
# codec configuration from
# http://code.google.com/p/bencos/source/browse/trunk/out/presets/libx264-lossless_ultrafast.ffpreset?r=156
cat > libx264-lossless_ultrafast.ffpreset <<EOF
coder=0
flags=+loop
cmp=+chroma
partitions=-parti8x8-parti4x4-partp8x8-partp4x4-partb8x8
me_method=dia
subq=0
me_range=16
g=250
keyint_min=25
sc_threshold=40
i_qfactor=0.71
b_strategy=1
qcomp=0.6
qmin=0
qmax=69
qdiff=4
directpred=1
flags2=+fastpskip
cqp=0
EOF
# ffmpeg command line adapted from
# http://wiki.oz9aec.net/index.php/High_quality_screen_capture_with_Ffmpeg
ffmpeg \
-f x11grab -r 30 -s 1680x1050 -i :0.0 \
-f alsa -ac:0 2 -i pulse \
-f alsa -ac:1 1 -i pulse \
-vcodec libx264 -fpre libx264-lossless_ultrafast.ffpreset -acodec pcm_s16le \
-map 0 -map 1,0 -map 2,0 \
-threads 0 output.mkv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment