Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # NAME
- # record-screen - script for recording your screen with FFmpeg!
- #
- # SYNOPSIS
- # ./record-screen [FILE]
- #
- # NOTES
- # • This script assumes that you are using a recent NVIDIA GPU and that you
- # want to be recording lossless HVEC/H.265 video.
- #
- # • Please note that this will likely only work reliably with single-monitor
- # setups... Otherwise it picks the first 'connected' monitor from xrandr's
- # list...
- #
- # • If you are downloading this from a GitHub Gist, be sure to 'chmod +x' this
- # script before attempting to run it!
- #
- # TODO
- # • Add support for other encoding schemes and acceleration.
- resolution="$( xrandr \
- | grep -w connected \
- | awk -F'[ \+]' '{print $3}' 2> /dev/null \
- | head -n1 \
- )"
- ffmpeg -video_size $resolution \
- -analyzeduration 2048M \
- -probesize 2048M \
- -framerate 60 \
- -f x11grab \
- -i :0.0 \
- -c:v hevc_nvenc -preset lossless -threads 0 \
- "$1" \
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement