ubuntuusers.de

Screencast Toggle, avconv

Autor:
mrkramps
Datum:
29. Juli 2014 23:00
Code:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Dependencies: libav-tools
# Usage: ./script to start and ./script again to stop
set -x
rate="25"
area="1920x1080"
res="1280x720"
screen="0"
display="0"
output="$HOME/Videos/Screencasts/$(date +'%Y-%m-%d_%H-%M-%S').flv"
pidfile="/tmp/screencast.pid"

if [ -e "$pidfile" ]
then
	kill "$(cat "$pidfile")"

	rm "$pidfile"

	notify-send -i gnome-screenshot "SCREENCAST STOPPED" \
	"The screencast was saved to $output"
else
	notify-send -i gnome-screenshot "SCREENCAST STARTED" \
	"The screencast will be save to $output"

	avconv -v quiet -f x11grab -r "$rate" -s "$area" -i :"$screen"."$display" \
	-s "$res" -vcodec libx264 "$output" &

	echo $! > /tmp/screencast.pid
fi