OBS Studio/Recording Multiple Audio Sources

From TSG Doc
Jump to navigation Jump to search

A common limitation of audio recording software like Audacity is that they can only record from one audio device at a time. For multi-channel recordings, this means having to find an audio interface with an appropriate number of inputs. However, this often overcomplicates a setup. Another solution is to use OBS Studio to record from multiple audio devices simultaneously. The only caveat is that OBS is designed to record video, so it cannot record straight to audio file.[1] Thankfully, we can automate the afterwards conversion to audio file(s).

Below is a step-by-step guide on setting up OBS Studio for recording audio from 4 people, using two wireless receivers (2 lavalier microphones per receiver) connected via USB to a single PC/laptop.

Requirements

For the audio extraction, FFmpeg is required.

Configuration

Scene Setup

Adding Audio Input Capture Source

In a new/empty scene:

  1. Click the "+" icon at the bottom of the Sources panel.
  2. Select "Audio Input Capture" to add an audio input device.
  3. Select "Create new" and give the source a descriptive name so you can distinguish it from the other(s).
  4. Click "OK".
  5. From the drop-down menu, select one of the audio devices you want to record from and click "OK".
  6. You should now see the new device show up in the Audio Mixer panel, where you can monitor its input volume.
  7. Repeat for all additional devices.

Note: if you have connected multiple devices of the same type, they may all have identical names in the drop-down menu. Remember which one you picked for each source. To check which is which, speak into one of the microphones and see which volume meter lights up in the Audio Mixer panel. You can always swap devices around by clicking the Audio Input Source and changing the Device in the properties panel.

Two sources added. Signals from mic A1 and B2 are visible in the Audio Mixer


Track Routing

OBS can output up to 6 separate audio tracks. All tracks are stereo by default, so will record 2 channels per track. Using the mixer, you can determine which audio source gets recorded onto which track.

  1. Open the Advanced Audio Properties menu by clicking the cogs icon in the Audio Mixer panel.
  2. Assign each input to its own Track. [2]
  3. Take note of which input you routed to which track.
Track routing settings


Settings

  1. Goto File -> Settings
  2. Goto the Output page (sidebar).
  3. Set Output Mode to "Advanced".

Recording Settings

  1. Select the Recording tab.
  2. Set your Recording Path to where you want to store the recordings.
  3. Set the Recording Format to "Matroska Video (.mkv)".[3]
  4. Set Audio Encoder to "FFmpeg PCM (16-bit)" for lossless audio recording.
  5. Make sure the Audio Tracks you routed to earlier are checked (in this case #1, #2 and #3), and the others are unchecked.
  6. Under Encoder Settings, set Rate Control to "CBR".
  7. Set Bitrate to 50 Kbps (the minimum), since we are not interested in the video quality. This helps keep the overall file size down.[4]
Output Recording settings

Audio Track Setup

(optional)

  1. Select the Audio tab (next to Recording tab).
  2. Name your audio tracks so you can easily recognize them again later. Otherwise, they'll be called "Track 1", "Track 2", etc.

Note: Audio Bitrate does not apply to PCM audio encoding, so you can leave the default values.

Output Audio settings

Audio Settings

  1. Goto the Audio page (sidebar).
  2. Set Sample Rate to 48kHz.
  3. Set Channels to "Stereo".

Click "Apply" to apply settings and close the settings menu.

General Audio settings

Recording

  1. Click "Start Recording" to start recording when you're ready.
  2. Click "Stop Recording" to stop recording.

The recorded video file can be found in the folder you selected before. You can open said folder via File -> Show Recordings.

Extracting Audio

You can extract the audio from the video file and save each channel as individual .wav file using FFmpeg. Below is a Python3 script to process your recording. Change "src" and "dst" to the paths applicable to you.

import subprocess
import os

######################################################
# CHANGE THESE TO POINT AT THE CORRECT FILES/FOLDERS #
######################################################

src = "C:\\Recordings\\2026-01-15_11-26-25.mkv"         # source video
dst = "C:\\Recordings\\Audio"                           # output folder

######################################################

if not os.path.exists(dst):
    os.mkdir(dst)

def extract_audio_channels(path:str):
    # Get audio channel configuration from ffprobe. Expected to return "<streamId>|<numChannels>|<streamTitle>"
    cmd = f'ffprobe -v error -select_streams a -show_entries stream_tags=title:stream=index,channels -of compact=p=0:nk=1 "{path}"'
    output = subprocess.run(cmd, check=True, capture_output=True, text=True)

    if (output.stdout is None or output.stdout == ""):
        print("Error: no audio channels detected")
        return

    file_name = os.path.splitext(os.path.basename(path))[0]

    # Extract each channel from each stream individually
    for stream in output.stdout.splitlines():
        idx, chans, stream_name = stream.split('|')
        for i in range(int(chans)):
            print(f'Extracting stream {idx} ({stream_name}) channel {i}...')
            cmd = f'ffmpeg -i "{path}" -map 0:a:{int(idx)-1} -af "pan=mono|c0=c{i}" -y "{dst}\\{file_name}_{stream_name}_{i}.wav"'
            subprocess.run(cmd)

if __name__ == "__main__":
    extract_audio_channels(src)

The script uses FFprobe to check the audio track and channel configuration. FFprobe comes with FFmpeg. It then uses FFmpeg itself to write each channel in each track to a separate .wav file (mono), using the same PCM 16-bit encoding as before.

The file names will include the track name (as set in the Audio tab, or "Track 1", "Track 2", etc. by default) and channel id (0 for left, 1 for right).

Batch Processing (Windows)

To process multiple video recordings at once:

  1. Download and extract File:Extract audio per channel.zip.
  2. Edit the script to match your input and output folders.
  3. Run the batch file.

Automatic Processing In OBS Studio

If you use this recording setup often, we can automate the process even more by integrating the script into OBS Studio:

  1. Download and extract File:Obs extract audio per channel.zip
  2. In OBS Studio, goto Tools -> Scripts.
  3. Click the + icon.
  4. Browse to the downloaded script and open it.
  5. Customize the output folder if needed.

OBS Studio will now automatically process the video file the moment you click "Stop Recording" :)

See Also

References

  1. Technically, there are ways in OBS to write directly to e.g. MP3, however we recommend using the method described above for better data safety.
  2. If multiple Inputs route to the same Track, they get mixed together in the recording.
  3. The MKV format allows for file recovery in case of a crash, unlike e.g. MP4. This makes recording to MKV a safer option.
  4. See OBS Studio for recommendations if you do wish to record video at the same time