What is the right parameter for ffmpeg to record audio+video simultaneously?

I have been searching the internet on how to record a streaming playback with video and audio. I found this recipe:

ffmpeg -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0 -f pulse -ac 2 -i default recording.mkv

Probably one of the -i parameters was wrong: The shown command gives me only a recording of the video channel, the sound is missing.

Earlier, searching for a recipe fro a pure audio recording, I was told to look at the output of

pactl list short sources

which is

0   alsa_output.pci-0000_00_1b.0.analog-stereo.monitor  module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED
1   alsa_output.usb-Sennheiser_Communications_Sennheiser_USB_headset-00.analog-stereo.monitor   module-alsa-card.c  s16le 2ch 48000Hz   SUSPENDED
2   alsa_input.usb-Sennheiser_Communications_Sennheiser_USB_headset-00.multichannel-input   module-alsa-card.c  s16le 1ch 48000Hz   SUSPENDED

and substitute the finding for the ALSA output device. Therefore I substituted alsa_output.usb-Sennheiser_Communications_Sennheiser_USB_headset-00.analog-stereo.monitor into the command

ffmpeg -f pulse -i alsa_output.usb-Sennheiser_Communications_Sennheiser_USB_headset-00.analog-stereo.monitor -ac 2 recording.mp3

and I was able to make a recording of a pure audio playback with it.

I applied a similar modification to my first trial command:

ffmpeg -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0 \
-f pulse -ac 2 \
-i alsa_output.usb-Sennheiser_Communications_Sennheiser_USB_headset-00.analog-stereo.monitor \
recording.mkv

But again this gave me only a silent recording. My command was definitely not the right one, although I heard the sound on the headset during the recording, but not after it on playback.

What would be the right command to make an audio+video recording?

Read more here: Source link