Overhaul of screencasting scripts
This commit is contained in:
parent
e2225d418d
commit
f61ab66785
10 changed files with 92 additions and 101 deletions
|
@ -26,8 +26,6 @@ set $term --no-startup-id st
|
||||||
set $stoprec --no-startup-id killall ffmpeg
|
set $stoprec --no-startup-id killall ffmpeg
|
||||||
|
|
||||||
# #---Starting External Scripts---# #
|
# #---Starting External Scripts---# #
|
||||||
#Increase key rate
|
|
||||||
exec --no-startup-id xset r rate 300 50
|
|
||||||
#Music player daemon:
|
#Music player daemon:
|
||||||
exec --no-startup-id mpd
|
exec --no-startup-id mpd
|
||||||
#Torrent daemon:
|
#Torrent daemon:
|
||||||
|
@ -367,7 +365,7 @@ bindsym $mod+Shift+bracketright exec $bigfor
|
||||||
# For screenshots and recording
|
# For screenshots and recording
|
||||||
bindsym Print exec --no-startup-id scrot
|
bindsym Print exec --no-startup-id scrot
|
||||||
bindsym Shift+Print exec --no-startup-id scrot -u
|
bindsym Shift+Print exec --no-startup-id scrot -u
|
||||||
bindsym $mod+Print exec --no-startup-id record
|
bindsym $mod+Print exec --no-startup-id dmenurecord
|
||||||
bindsym $mod+Scroll_Lock exec --no-startup-id "killall screenkey || screenkey"
|
bindsym $mod+Scroll_Lock exec --no-startup-id "killall screenkey || screenkey"
|
||||||
bindsym $mod+Delete exec $stoprec
|
bindsym $mod+Delete exec $stoprec
|
||||||
bindsym XF86Launch1 exec $stoprec & xset dpms force off
|
bindsym XF86Launch1 exec $stoprec & xset dpms force off
|
||||||
|
|
27
.scripts/audio
Executable file
27
.scripts/audio
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This script records audio.
|
||||||
|
# It runs an appropriate record script for either ALSA and Pulseaudio.
|
||||||
|
# It also names files smartly to prevent overwrites.
|
||||||
|
|
||||||
|
# Picks a file name for the output file based on availability:
|
||||||
|
while [[ -f $HOME/screencast$n.mkv ]]
|
||||||
|
do
|
||||||
|
n=$((n+1))
|
||||||
|
done
|
||||||
|
filename="$HOME/screencast$n.mkv"
|
||||||
|
|
||||||
|
# For Pulseaudio with ALSA:
|
||||||
|
record_pulse() { \
|
||||||
|
ffmpeg \
|
||||||
|
-f alsa -i default \
|
||||||
|
-c:a flac \
|
||||||
|
$filename ;}
|
||||||
|
|
||||||
|
# For ALSA:
|
||||||
|
record_alsa() { \
|
||||||
|
ffmpeg -y \
|
||||||
|
-f alsa -ar 44100 -i hw:1 \
|
||||||
|
$filename ;}
|
||||||
|
|
||||||
|
if [[ $(pgrep -x pulseaudio) ]]; then record_pulse; else record_alsa; fi
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#This is the ffmpeg command that the screencast shortcut in i3 will run.
|
|
||||||
|
|
||||||
#Picks a file name for the output file based on availability:
|
|
||||||
|
|
||||||
while [[ -f $HOME/audio$n.flac ]]
|
|
||||||
do
|
|
||||||
n=$((n+1))
|
|
||||||
done
|
|
||||||
filename="$HOME/audio$n.flac"
|
|
||||||
|
|
||||||
#The actual ffmpeg command:
|
|
||||||
|
|
||||||
ffmpeg -y \
|
|
||||||
-f alsa -ar 44100 -i hw:1 \
|
|
||||||
$filename
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#This is the ffmpeg command that the audio shortcut in i3 will run.
|
|
||||||
|
|
||||||
#Picks a file name for the output file based on availability:
|
|
||||||
|
|
||||||
while [[ -f $HOME/audio$n.flac ]]
|
|
||||||
do
|
|
||||||
n=$((n+1))
|
|
||||||
done
|
|
||||||
filename="$HOME/audio$n.flac"
|
|
||||||
|
|
||||||
#The actual ffmpeg command:
|
|
||||||
|
|
||||||
ffmpeg \
|
|
||||||
-f alsa -i default \
|
|
||||||
-c:a flac \
|
|
||||||
$filename
|
|
24
.scripts/dmenurecord
Executable file
24
.scripts/dmenurecord
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# A dmenu recording prompt for my different recording scripts.
|
||||||
|
|
||||||
|
# Asks for type of recording and uses one of my three different scripts.
|
||||||
|
asktype() { \
|
||||||
|
case $(echo -e "Screencast\nVideo only\nAudio only" | dmenu -i -p "Select recording style:") in
|
||||||
|
Screencast) screencast ;;
|
||||||
|
"Audio only") audio ;;
|
||||||
|
"Video only") video ;;
|
||||||
|
esac ;}
|
||||||
|
|
||||||
|
# If already running, will ask to end previous recording.
|
||||||
|
|
||||||
|
asktoend() { \
|
||||||
|
response=$(echo -e "No\nYes" | dmenu -i -p "Recording still active. End recording?") &&
|
||||||
|
if [[ "$response" = "Yes" ]]; then killall ffmpeg; fi ;}
|
||||||
|
|
||||||
|
if (( $(pgrep dmenurecord | wc -l) > 2 )); then
|
||||||
|
asktoend;
|
||||||
|
else
|
||||||
|
asktype;
|
||||||
|
fi
|
||||||
|
echo $response
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# A dmenu recording prompt for my different
|
|
||||||
|
|
||||||
case $(echo -e "Screencast\nVideo only\nAudio only" | dmenu -i -p "Select recording style:") in
|
|
||||||
Screencast) (pgrep -x pulseaudio && screencast_pulse.sh) || screencast_alsa.sh ;;
|
|
||||||
"Audio only") (pgrep -x pulseaudio && audio_pulse.sh) || audio_alsa.sh ;;
|
|
||||||
"Video only") video.sh ;;
|
|
||||||
esac
|
|
36
.scripts/screencast
Executable file
36
.scripts/screencast
Executable file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This script records a screencast with audio and video.
|
||||||
|
# It runs an appropriate record script for either ALSA and Pulseaudio.
|
||||||
|
# It also names files smartly to prevent overwrites.
|
||||||
|
|
||||||
|
# Picks a file name for the output file based on availability:
|
||||||
|
while [[ -f $HOME/screencast$n.mkv ]]
|
||||||
|
do
|
||||||
|
n=$((n+1))
|
||||||
|
done
|
||||||
|
filename="$HOME/screencast$n.mkv"
|
||||||
|
|
||||||
|
# For Pulseaudio with ALSA:
|
||||||
|
record_pulse() { \
|
||||||
|
ffmpeg -y \
|
||||||
|
-f x11grab \
|
||||||
|
-framerate 60 \
|
||||||
|
-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
|
||||||
|
-i :0.0 \
|
||||||
|
-f alsa -i default \
|
||||||
|
-r 30 \
|
||||||
|
-c:v libx264rgb -crf 0 -preset ultrafast -c:a flac $filename ;}
|
||||||
|
|
||||||
|
# For ALSA:
|
||||||
|
record_alsa() { \
|
||||||
|
ffmpeg -y \
|
||||||
|
-f x11grab \
|
||||||
|
-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
|
||||||
|
-i :0.0 \
|
||||||
|
-thread_queue_size 1024 \
|
||||||
|
-f alsa -ar 44100 -i hw:1 \
|
||||||
|
-c:v libx264 -r 30 -c:a flac $filename ;}
|
||||||
|
|
||||||
|
|
||||||
|
if [[ $(pgrep -x pulseaudio) ]]; then record_pulse; else record_alsa; fi
|
|
@ -1,22 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#This is the ffmpeg command that the screencast shortcut in i3 will run.
|
|
||||||
|
|
||||||
#Picks a file name for the output file based on availability:
|
|
||||||
|
|
||||||
while [[ -f $HOME/screencast$n.mkv ]]
|
|
||||||
do
|
|
||||||
n=$((n+1))
|
|
||||||
done
|
|
||||||
filename="$HOME/screencast$n.mkv"
|
|
||||||
|
|
||||||
#The actual ffmpeg command:
|
|
||||||
|
|
||||||
ffmpeg -y \
|
|
||||||
-f x11grab \
|
|
||||||
-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
|
|
||||||
-i :0.0 \
|
|
||||||
-thread_queue_size 1024 \
|
|
||||||
-f alsa -ar 44100 -i hw:1 \
|
|
||||||
-c:v libx264 -r 30 -c:a flac $filename
|
|
||||||
#-c:v ffvhuff -r 30 -c:a flac $filename
|
|
|
@ -1,25 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
#This is the ffmpeg command that the screencast shortcut in i3 will run.
|
|
||||||
|
|
||||||
#Picks a file name for the output file based on availability:
|
|
||||||
|
|
||||||
while [[ -f $HOME/screencast$n.mkv ]]
|
|
||||||
do
|
|
||||||
n=$((n+1))
|
|
||||||
done
|
|
||||||
filename="$HOME/screencast$n.mkv"
|
|
||||||
|
|
||||||
#The actual ffmpeg command:
|
|
||||||
|
|
||||||
ffmpeg -y \
|
|
||||||
-f x11grab \
|
|
||||||
-framerate 60 \
|
|
||||||
-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
|
|
||||||
-i :0.0 \
|
|
||||||
-thread_queue_size 2048 \
|
|
||||||
-f alsa -i default \
|
|
||||||
-r 30 \
|
|
||||||
-c:v libx264 -r 30 -c:a flac $filename
|
|
||||||
#-c:v ffvhuff -r 30 -c:a flac $filename
|
|
||||||
#-f pulse -ac 1 -ar 44100 -i default \
|
|
|
@ -1,21 +1,18 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#This is the ffmpeg command that the screencast shortcut in i3 will run.
|
# This script records video.
|
||||||
|
# It also names files smartly to prevent overwrites.
|
||||||
|
|
||||||
# Picks a file name for the output file based on availability:
|
# Picks a file name for the output file based on availability:
|
||||||
|
|
||||||
while [[ -f $HOME/video$n.mkv ]]
|
while [[ -f $HOME/video$n.mkv ]]
|
||||||
do
|
do
|
||||||
n=$((n+1))
|
n=$((n+1))
|
||||||
done
|
done
|
||||||
filename="$HOME/video$n.mkv"
|
filename="$HOME/video$n.mkv"
|
||||||
|
|
||||||
|
|
||||||
# The actual ffmpeg command:
|
# The actual ffmpeg command:
|
||||||
|
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
-f x11grab \
|
-f x11grab \
|
||||||
-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
|
-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
|
||||||
-i :0.0 \
|
-i :0.0 \
|
||||||
-c:v libx264 -qp 0 -r 30 $filename
|
-c:v libx264 -qp 0 -r 30 $filename
|
||||||
#-c:v ffvhuff -r 30 -c:a flac $filename
|
|
Loading…
Reference in a new issue