Skip to content

Instantly share code, notes, and snippets.

@opnchaudhary
Created February 10, 2019 10:15
Show Gist options
  • Save opnchaudhary/8bdc1e0bef54d9beeff9584219a91b9f to your computer and use it in GitHub Desktop.
Save opnchaudhary/8bdc1e0bef54d9beeff9584219a91b9f to your computer and use it in GitHub Desktop.
Bash aliases using ffmpeg to capture desktop and webcam
# To take a screenshot screen.png:
alias screencapture='ffmpeg -f x11grab -video_size 1366x768 -i $DISPLAY -vframes 1 screen.png'
# To take a screencast screen.mkv with lossless encoding and without audio:
alias recorddesktopmkv='ffmpeg -f x11grab -video_size 1366x768 -framerate 25 -i $DISPLAY -c:v ffvhuff screen.mkv'
# To take a screencast screen.mp4 with lossy encoding and with audio:
alias recorddesktopmp4='ffmpeg -f x11grab -video_size 1366x768 -framerate 25 -i $DISPLAY -f alsa -i default -c:v libx264 -preset ultrafast -c:a aac screen.mp4'
# To record a video webcam.mp4 from the webcam without audio
alias recordwebcamv='ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -c:v libx264 -preset ultrafast webcam.mp4'
# To record a video webcam.mp4 from the webcam with audio:
alias recordwebcamav='ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -f alsa -i default -c:v libx264 -preset ultrafast -c:a aac webcam.mp4'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment