For OpenBSD screen recording audio and video we use ffmpeg for video and aucat for audio and then merge it into a single file with the script.
Before you can do that, you need to have your system ready to record audio on OpenBSD, do the following:
In /etc/rc.conf.local you must add the page and restart the audio daemon.
sndiod_flags=-s default -m play,mon -s mon
Or execute the following:
rcctl set sndiod flags -s default -m play,mon -s mon
rcctl restart sndiod
Then try to record the sound on the screen with OpenBSD:
aucat -f snd/mon -o file.wav
Listen to what we have recorded. If it works, go ahead.
aucat -i file.wav
So we create a file with any name we want, just type in record.sh and fill it with the following text:
#!/bin/sh
if (dialog --yesno "Start Record?" 20 78); then exec aucat -f snd/mon -o 1.wav & ffmpeg -video_size 1920x1080 -framerate 30 -f x11grab -i :0.0 -c:v libx264 -qp 0 -preset ultrafast 1.mkv 2> /dev/null &
if (dialog --msgbox 'Stop Record and wait 10 seconds!' 6 20); then exec pkill ffmpeg aucat & sleep 10
if (dialog --yesno "Merge Audio and Video?" 20 78); then exec ffmpeg -i 1.mkv -i 1.wav -c copy Full.mkv;
fi
fi
fi
After that make it executable chmod a+x and that's it.
BSD is so easy and fun.