[qubes-users] recording qubes-sessions e.g. videos

Hi all, I found a script to record cubes sessions, e.g. videos on webbrowsers.
The problem is that it does not record the sound!
The media vm is based on debian10 template with a lot of stuff installed in my case.

Any Idea to solve this? Here is the script that I collected from github.
The printf is for debugging.

user@media:~ cat record_screen.sh #!/bin/bash #pass in alsa or pulse to record from sound device IFS=
#omit the top pixels to hide tabs and address bar
FIREFOX_Y_BUFFER=94
FIREFOX_X_BUFFER=2
if [[ {1} =~ alsa ]] ; then sound="-f alsa -ac 2 -i hw:0" printf "alsa sound" fi if [[ {1} =~ pulse ]] ; then
sound="-f pulse -ac 2 -i default"
printf “pulse sound”
fi
echo $sound
output=xwininfo
width=echo $output | grep Width: | awk '{print $2}'
height=echo $output | grep Height: | awk '{print $2}'
topleftX=echo $output | grep "Absolute upper-left X:" | awk '{print $4}'
topleftY=echo $output | grep "Absolute upper-left Y:" | awk '{print $4}'
winid=echo $output | grep "Window id:" | awk '{print $4}'
window=xprop -id $winid WM_CLASS
window={window##*WM_CLASS(STRING) = } window={window##*, }
window=${window//"}
window=echo $window | sed 's/:/_/g'
if [[ {window} =~ Firefox ]] || [[ {window} =~ Icecat ]] ; then
topleftY=(( {topleftY} + {FIREFOX_Y_BUFFER} )) topleftX=(( {topleftX} + {FIREFOX_X_BUFFER} ))
width=(( {width} - {FIREFOX_X_BUFFER} )) height=(( {height} - {FIREFOX_Y_BUFFER} ))
fi
ffmpeg -video_size {width}x{height} -framerate 25 -f x11grab -i :0.0+{topleftX},{topleftY} {sound} {window}.mp4