Skip to content

Instantly share code, notes, and snippets.

@aspotton
Created October 14, 2020 14:35
Show Gist options
  • Save aspotton/8052051eff784e093d3750b349324d9f to your computer and use it in GitHub Desktop.
Save aspotton/8052051eff784e093d3750b349324d9f to your computer and use it in GitHub Desktop.
Bash script to record my second monitor with sound output mixed with USB microphone input. Can be used to record Zoom, Google Meet, or other calls with full audio even if you don't have the record permission.
#!/bin/bash
# Records only speaker output
#/usr/bin/ffmpeg -f x11grab -y -r 15 -s 1920x1080 -i :1.0+1920,0 -f pulse -i default -vcodec mpeg4 -qscale 0 ~/video.mp4
# Records speaker output and webcam microphone input together (Pulse audio)
# Find microphone: pacmd list-sources
# Test recording: ffmpeg -f pulse -ac 2 -i alsa_input.usb-046d_0821_AE9295A0-00.analog-stereo test.mp4
/usr/bin/ffmpeg -f x11grab -y -r 15 -s 1920x1080 -i :1.0+1920,0 -f pulse -i alsa_output.usb-DisplayLink_Plugable_UD-ULTCDL_10027015-02.analog-stereo.monitor -f pulse -ac 2 -i alsa_input.usb-046d_0821_AE9295A0-00.analog-stereo -filter_complex "[1:0][2:0]amix=inputs=2:duration=shortest" -vcodec mpeg4 -qscale 0 ~/video.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment