Gnome Screencast Tool (Crtl + Alt + Shift + R)
To convert videos from web to mp4 and decrease frame rates, we can use the command below:
ffmpeg -r 5 -i Videos/Screencasts/tutorial.webm -c:v libx264 -preset veryfast -c:a aac -vf "crop=trunc(iw/2)*2:trunc(ih/2)*2" Desktop/tutorial.mp4
Custom script to record audio as well
#!/bin/bash
# Get screen resolution
RESOLUTION=$(xrandr | grep '*' | awk '{print $1}')
WIDTH=$(echo $RESOLUTION | cut -d 'x' -f 1)
HEIGHT=$(echo $RESOLUTION | cut -d 'x' -f 2)
# Define file names
VIDEO_FILE="screencast_$(date +%Y%m%d_%H%M%S).mp4"
AUDIO_FILE="audio_$(date +%Y%m%d_%H%M%S).wav"
OUTPUT_FILE="output_$(date +%Y%m%d_%H%M%S).mp4"
# Start recording video with lower frame rate and more efficient encoding
ffmpeg -video_size ${WIDTH}x${HEIGHT} -framerate 5 -f x11grab -i :0.0 -c:v libx264 -preset veryfast -crf 23 -y $VIDEO_FILE &
# Start recording audio
ffmpeg -f alsa -i default -y $AUDIO_FILE &
# Wait for user to stop the recording
echo "Press any key to stop recording..."
read -n 1
# Kill all ffmpeg processes
pkill -f ffmpeg
# Merge video and audio with efficient encoding
ffmpeg -i $VIDEO_FILE -i $AUDIO_FILE -c:v libx264 -preset veryfast -crf 23 -c:a aac -strict experimental $OUTPUT_FILE
echo "Recording saved as $OUTPUT_FILE"
Appendix. Install ffmpeg
sudo apt install ffmpeg