# Screen cast with ffmpeg Change resolution of display xrandr --output $MAINDISPLAY --mode 1280x720 Start recording with screencast() { # Arguments to ffmpeg deskSound="-f pulse -ac 2 -ar 44100 -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor" micSound="-f pulse -ac 2 -ar 44100 -i alsa_input.usb-USB_Microphone_USB_Microphone-00.analog-stereo" sound="$deskSound $micSound -filter_complex amix=inputs=2" sound="" grab="-f x11grab -r 30 -s 1280x720 -i :0.0+2560,622" vcodec="-vcodec libx264 -preset veryfast -crf 18" acodec="-acodec libmp3lame -ar 44100 -q:a 1" other="-pix_fmt yuv420p" output="episode_${1}.mkv" ffmpeg $sound $grab $vcodec $acodec $other $output }