X11grab of screen/area

I’m using Ubuntu 18.04 with ffmpeg 3.4.6

I want to grab (video & sound) of the whole screen or grab (video & sound) of a region (e.g. window or area, in the screen) using ffmpeg. I found an example at https://wiki.ubuntu.com/ScreenCasts/ffmpeg:
ffmpeg -f x11grab -r 25 -s 1024x768 -i :0.0 -vcodec huffyuv screencast.avi
But it doesn’t create an avi file and gives “Output file #0 does not contain any stream”.
I adapted it slightly (i.e. for my monitor) but it didn’t work.
ffmpeg -f x11grab -r 25 -s 1920x1080 -i :0.0 -f pulse -vcodec huffyuv screencast.avi
I’ve tried other variants e.g.:
ffmpeg -r 25 -video_size 1920x1080 -f x11grab -draw_mouse 0 -show_region 1 -i :0.0 -f pulse -ac 2 -i default -vcodec libx265 -y /home/john/Temporary/v.mp4 >/home/john/Temporary/l.txt 2>&1
That creates a .mp4 file but but won’t play (in vlc or video player) as it has unknown video codec & audio codec in its properties.