blob: b8050daa4d5a60e7e027c92cc5fb63b653361709 (
plain) (
tree)
|
|
#!/bin/sh
## Config
output_dir=~/videos/screencasts
#sound_device=/dev/dsp4.0
#-thread_queue_size 512 -f oss -i "$sound_device" \
## Start recording
start_recording() {
touch /tmp/cast.mkv
notify-send -t 3000 "Starting screencast." "3...2...1..."
sleep 4
pkill -76 i3blocks
ffmpeg -video_size 1920x1080 \
-framerate 50 \
-thread_queue_size 512 -f x11grab -i :0.0+0,0 \
-vcodec libx264rgb -crf 0 -preset:v ultrafast \
-acodec pcm_s16le \
-af aresample=async=1:first_pts=0 \
-y \
/tmp/cast.mkv
}
## Stop recording
stop_recording() {
pkill -2 ffmpeg
output_file="$output_dir"/cast_"$(date '+%F-%H-%M-%S')".mp4
notify-send "Screencast stopped, transcoding..." "$output_file"
ffmpeg -i /tmp/cast.mkv "$output_file" && rm /tmp/cast.mkv
pkill -76 i3blocks
notify-send "Transcode done!" "$output_file"
exit
}
## Main
mkdir -p "$output_dir"
[ -f /tmp/cast.mkv ] && stop_recording || start_recording
|