Skip to content

Instantly share code, notes, and snippets.

@chilkari
Created December 1, 2011 07:54
Show Gist options
  • Save chilkari/1414779 to your computer and use it in GitHub Desktop.
Save chilkari/1414779 to your computer and use it in GitHub Desktop.
ffmpeg for screencapture and transcode on linux
# Not really polished sh scripts. Following are two separate commands I use to capture, then
# transcode screen captures.
# Capture. Notice 640x480 for window size (you'll probably want to change) and the +0,264 for where to grab.
# As you can see, I save into my $HOME/screencap dir. These are essentially uncompressed audio/video.
#/bin/sh
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 640x480 -i :0.0+0,264 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 $HOME/screencap/cap.mkv
# Transcode. Just a basic watchable MP4 transcode of the above.
#/bin/sh
# crop syntax is -vf "crop=width:height:left:top" can do short beginning test with -t 10 (10 seconds)
ffmpeg -i $HOME/screencap/cap.mkv -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre medium -crf 22 -threads 0 $HOME/screencap/transcoded.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment