Question / Help Trying to develop a multitrack audio capture workflow

unfa

Member
Hi!

Is there any documentation describing in detail how the multiple audio tracks feature works in OBS?

I'm making music production tutorials and I often struggle to get the levels right when recording, and it'd be awesome I if I could save multiple audio files along with the video file to mix them in post if I screw up the live mix.

Looks like OBS has some features fro this, but I wasn't able to make them work for me.

I see that OBS can encode audio in 32-bit float PCM, which is great, because that format gives makes me safe from clipping and gives me the most flexibility in post-production. Now I just need to figure out how to capture more than 2 channels.

PS:

I've found this guide: https://obsproject.com/forum/resour...lity-recording-and-multiple-audio-tracks.221/

And looks like in my OBS 19.0.2 I can only choose one audio track to be recorded. There is no way to get more, there are radio buttons, not checkboxes like in the guide. Is this feature not supported on Linux or something?

PPS:

In Type = Standard I can select multiple audio tracks, but then I have no control over the audio encoder, and in Type = Custom Output (FFmpeg) I can select any encoder I want (pcm_f32le), but I can only select one audio track fro capture - what gives? I'd think that the custom output will allow multiple audio tracks, if the simple one does? Is this a bug or I am missing something?
 

Attachments

  • Screenshot_20170615_162232.png
    Screenshot_20170615_162232.png
    10.6 KB · Views: 25
Last edited:

unfa

Member
I've created a bash script that captures audio when I capture video with OBS.
Here's a part of it responsible for the audio recording:

audio_capture(){
cd "$BASE_DIR/Capture" # go to the Capture directory

while [ True ]; do
# wait until a new mkv file is created in the Capture directory
echo "waiting for capture to start"

watch -n0,1 -g "ls -t *.mkv | head -n 1"

# once it is, start recording to a WAV file with the same name as the newest mkv file
#channels:
# 1 - raw mic input
# 2 - processed mic input
# 3,4 - raw audio
# 5,6 - master, before the limiter

echo "starting capture"

jack_capture -c 6 -b 32 -f wav -p "system:capture_1" -p "Non-Mixer/Vox:out-1" -p "Non-Mixer/Audio:out-*" -p "Non-Mixer/MASTER:out-*" -fn "$(ls -t *.mkv | head -n 1 | cut -d'.' -f-1).wav" &

pid_cap=$! # store the capture process PID

echo "capture PID is $pid_cap"

A="10000" # initilize with 0

while [ True ]; do
echo "checking if capture has stopped"
B=$A
sleep 5s # wait - this will let the process skip soem hard disk write hiccups and also give us some backup post-roll
A=$(du "$(ls -t *.mkv | head -n 1)" | cut -f 1) # get teh size in bytes of the newest MKV file in dir
if [ $A -eq $B ]; then #if the sizedidn't change recently
echo "stopping capture"
#kill $pid_cap
#break
fi;
done
done
}

It works by monitoring the OBS capture directory for new files. Then it starts jack_capture to record a 6-channel WAV in the same dir. For some reason the jack_capture line works fine when I run it in a separate terminal, but doesn't work in this script. It exits without reporting any specific errors right after writing a header to the WAV file and behaves like someone pressed Enter or Ctrl+C in the terminal. it once managed to capture a few seconds before closing. Can you see an error in my script? I attach the full script.

I wonder if this isn't somehow OBS console output feeding to that shell, but how is that even possible?

PS: I tried redirecting /dev/null to jack_capture stdin to avoid something like this, but still no go. Verobse output makes it say this:


waiting for capture to start (my script's notice)
starting capture (my script's notice)
capture PID is 20591 (my script's notice)
checking if capture has stopped (my script's notice)
main() find default file format
main() find filename
main() init jack 1
buf_size_in_bytes: 6152
main() init buffers
bufinit1. sizeof(long): 8, sizeof(float): 4, sizeof(double):8, sizeof(int):4, sizeof(void*):8
>>> Warning. Could not set higher priority for a SCHED_FIFO process using setpriority().
main() Open soundfile and setup disk callback.
main() Init waiting.
main() Init jack 2.
main() Everything initialized. 8
main() Start meterbridge.
main() Print some info. 42
>>> Recording to "2017-06-15 21-28-37.wav". Press <Return> or <Ctrl-C> to stop.
main() Start helper thread. 7
main() Wait.
main() Stop recording and clean up. 52
connection thread finished
disk thread finished 7
|"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""|
00:|- | 9:02 00:| ||
01:| | 7
02:| |
03:| |
04:| |
05:| |
Buffer: 4.01s./4.01s Time: 0.00m. DHP: [ ] Overruns: 0 Xruns: 0
Finished.

I wonder why this isn't working.
 

Attachments

  • studio.sh.txt
    3.2 KB · Views: 14
Last edited:
Top