Screen cast and capture video cam and show both on screen using ffmpeg
This solution works in Linux. 
To screen cast with inset video of yourself on screen where you have a video camera that is located at /dev/video0, paste the following into a text file and name it start_recording.sh or something similar and make it executable

#!/bin/bash




#####  set variables below ####

location_dir=$HOME/Desktop

T="$(date +%d-%m-%Y-%H-%M-%S)".mkv

#echo $T

video_window_title="$T"

#echo $video_window_title




####  Place video camera on own screen &amp; detach the process  ####
ffplay -window_title "$video_window_title" /dev/video0 &amp;




####  Record everything on the screen  ####
ffmpeg -y -f x11grab -s \
`xdpyinfo | grep 'dimensions:'|awk '{print $2}'` \
-i :0.0 -f alsa \
-i default $HOME/$T


To stop recording, paste the following into a text file and name it stop_recording.sh or something similar and make it executable

#!/bin/bash

# kills the ffmpeg and ffplay processes     
pkill ffmpeg &amp;&amp; pkill ffplay


The below two line script will make your inset video the always on top window, or not. Simply put the below two lines below in a text file, call it something like toggle_video_inset_to_always_above_layer_or_normal_layer.sh or something you can remember, and make it executable. 

#!/bin/bash

wmctrl -r $(wmctrl -lx | grep ffplay | grep -oE "[0-9a-z\._-]{20,25}$") -b toggle,above