kazam no sound and no red border for screencast
I tried xvidcap which I used to use before kazam, but after building it from source, I found it records each frame in a separate xwd file. So the solution appears to be to give up on kazam, just like on xvidcap.

I found that ffmpeg can be used to record a screencast like this. First, find out the screen resolution

xrandr


next, find out the audio source - we are looking for the number of the source that says alsa_output

pactl list sources


then start the screencast

ffmpeg -video_size 1920x1080 -framerate 20 -f x11grab -i :0.0 -f pulse -ac 2 -i 4 output.mp4


in this command, 1920x1080 is the screen resolution output from xrandr

-i 4  is the source number of alsa_output from pactl list sources

-ac 2 set 2 audio channels

-f pulse expected format is pulse audio

-i :0.0 video input from main screen

-f x11grab video input format is X server output format

the video is saved in output.mp4 and to stop the screencast, go to the terminal window and control-C