Skip to content

Instantly share code, notes, and snippets.

@n-st
Last active April 15, 2020 09:23
Show Gist options
  • Save n-st/058e661698572b8823fbbc4d21519f55 to your computer and use it in GitHub Desktop.
Save n-st/058e661698572b8823fbbc4d21519f55 to your computer and use it in GitHub Desktop.
PulseAudio configuration to stream video files and microphone audio to v4l2sink; locally hearing the video files but not the microphone.
#!/bin/sh
# PulseAudio configuration to stream video files and microphone audio to
# v4l2sink; locally hearing the video files but not the microphone.
# Video files -> OBS -> OBS Monitor -> "MediaInterim" \
# |-> Speakers
# `-> "FinalStream"
# Microphone -> "FinalStream"
pacmd load-module module-null-sink sink_name=FinalStream sink_properties=device.description="final_stream"
pacmd load-module module-null-sink sink_name=MediaInterim sink_properties=device.description="media_interim"
# Microphone to Stream
# Find your microphone source with `pactl list short sources`
pactl load-module module-loopback latency_msec=1 adjust_time=3 source=alsa_input.usb-046d_HD_Pro_Webcam_C920_685B4A2F-02.analog-stereo sink=FinalStream
# Media to Stream
pactl load-module module-loopback latency_msec=1 adjust_time=3 source=MediaInterim.monitor sink=FinalStream
# ... and also to Speakers
# Find your speaker sink with `pactl list short sinks`
pactl load-module module-loopback latency_msec=1 adjust_time=3 source=MediaInterim.monitor sink=alsa_output.pci-0000_00_1b.0.analog-stereo
echo "Don't forget to direct media players to media_interim, and record stream audio from final_stream!"
echo "Teardown: pacmd unload-module module-loopback; pacmd unload-module module-null-sink"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment