obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

obs-ffmpeg: Add option to output audio tracks in mono

Open Bleuzen opened this issue 10 months ago • 4 comments

Description

This adds the possibility to output individual audio tracks in Mono:

Motivation and Context

Currently we cannot set individual channel layouts per audio track, all tracks are recorded with the OBS global number of audio channels. Most people have OBS running in Stereo, which makes sense for music, game sounds and others. However it does not make sense for other things like most (mono) microphones. For that reason I added the ability to output specific tracks in Mono

How Has This Been Tested?

Did some recordings with this in MP4, FLV & MKV and tested different audio codecs like AAC, Opus, FLAC & PCM

Played back the recordings, ensured everything sounds as expected

Also verified with ffprobe

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [ ] I have included updates to all appropriate documentation.

Bleuzen avatar Apr 01 '24 22:04 Bleuzen

What problem or scenario does this solve that setting a device to Mono in Advanced Audio Properties does not handle?

Warchamp7 avatar Apr 06 '24 23:04 Warchamp7

What problem or scenario does this solve that setting a device to Mono in Advanced Audio Properties does not handle?

@Warchamp7 The option in the Advanced Audio Properties does make specific sources sound like they are mono by mixing all channels into each other however it still results in a multi-channel output so we end up with multiple copies of the exact same audio

The option implemented in this PR on the other hand does allow for true mono output

Also it operates per track instead of per audio source so it extends flexibility

Bleuzen avatar Apr 07 '24 00:04 Bleuzen

What problem or scenario does this solve that setting a device to Mono in Advanced Audio Properties does not handle?

@Warchamp7 The option in the Advanced Audio Properties does make specific sources sound like they are mono by mixing all channels into each other however it still results in a multi-channel output so we end up with multiple copies of the exact same audio

The option implemented in this PR on the other hand does allow for true mono output

Also it operates per track instead of per audio source so it extends flexibility

Is there a problem with setting OBS to single channel audio output?

Do you specifically want to be able to output ex. Audio Track 1 with 2 channels and Audio Track 2 with 1 channel?

What problem does this specifically solve? If this is an ease of use in another application such as a video editor, that's not sufficient.

Warchamp7 avatar May 06 '24 21:05 Warchamp7

Is there a problem with setting OBS to single channel audio output?

It would record ALL tracks in mono which is not desirable

Do you specifically want to be able to output ex. Audio Track 1 with 2 channels and Audio Track 2 with 1 channel?

as a simple example yeah

What problem does this specifically solve?

1.) It is an optimization - current OBS records multiple copies/channels of the exact same audio on all tracks that could be mono which just increases file size or bandwidth usage without a benefit and it does not make sense to save/stream unnecessary data

2.) Since this works per-track it makes it easier to quickly turn all audio sources on a track mono instead of having to make them mono one-by-one in the advanced audio properties window

3.) It extends flexibility by allowing for new kinds of setups like for example having the same sources go into a low bitrate mono track (for ultra-low bandwidth stream) and a high quality stereo track (for recording) at the same time

If this is an ease of use in another application

This also applies btw as a nice bonus

Bleuzen avatar May 07 '24 16:05 Bleuzen