Reading time: 5 – 8 minutes
I have two full-HD displays as a desktop and I want to record the second one of them while I record mic too. The output format of the record has to be MKV with h264 as video codec and AAC as audio codec.
After some tests with VLC and FFMPEG finally I get the solution with this command:
ffmpeg -f alsa -ac 2 -i default -f x11grab -r 15 -s 1920x1080+0+0 -i :0.0+1920,0 \ -acodec pcm_s16le -vcodec libx264 -preset ultrafast -threads 0 -y Test.mkv
when I finish recording the clip I have to convert the audio channel because if I try to convert the audio format while I’m recording the audio channel I have delays or sync problems with video channel.
ffmpeg -i Test.mkv -map 0:0 -map 0:1 \ -c:v copy \ -c:a:1 libfdk_aac -profile:a aac_he_v2 -b:a:1 96k \ output.mkv