Last active
September 13, 2022 01:23
-
-
Save xvzftube/1429d0c31bf7aaadcad34015b11095f5 to your computer and use it in GitHub Desktop.
:television: screencast with ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# getting started | |
# ================ | |
# - install pavucontrol and make sure default input is set to desired input | |
# - sudo apt install pavucontrol | |
# - mpv /dev/video0 is the webcam (most likely) | |
# - for HD change resolution with xrandr -d :0 -s 1280x720 or another | |
# youtube rec. resolution | |
# - If laptop is plugged into monitor and the excludsion of the laptop monitor is | |
# wanted then xrandr --output eDP-1 --off | |
# note on codec | |
# ============== | |
# The VP9 codec was used because it is more free than H.265 | |
# the video quality vs size tradoff maybe controlled with -crf | |
# crf ranges from 0-63 with 0 being highest quality | |
# -b:v 0 is a required flag and value. | |
# docs: https://trac.ffmpeg.org/wiki/Encode/VP9 | |
# | |
# note on container | |
# ================= | |
# Matroska mkv file format is GPL/BSD licensed | |
# Webm is built on top of mkv | |
# mkv is not a prefered format for some online video platforms | |
# mp4 is often prefered, but not free | |
# webm is also prefered and more free | |
# webm was chosen because it is more free than mp4 | |
# and is an acceptible format. | |
ffmpeg -y \ | |
-video_size $(xdpyinfo | grep dimensions | awk '{print $2;}') \ | |
-framerate 40 \ | |
-f x11grab \ | |
-i :0.0 \ | |
-c:v libvpx-vp9 -crf 25 -b:v 0 \ | |
~/videos/screen_recording_`date '+%Y-%m-%d_%H-%M-%S'.webm` \ | |
-f alsa -i default | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment