# support for multichannel audio in rtmp



## pkv (May 16, 2017)

hi
i'd like to draw more attention to :
https://obsproject.com/mantis/view.php?id=878

contrary to widespread belief, rtmp is not limited to stereo sound. 
it would be great to develop ability to stream with multichannel audio beyond stereo : 4.0 5.1 6.1 7.1 etc in rtmp
The main objection that there is no service able to deal with multichannel audio is no longer true.

Facebook live 360 now supports spatialization of sound with rtmp, check for instance:
https://fb360spatialwork...e-360-video-on-Facebook 

Ffmpeg and libfdk_aac can encode to a multichannel audio rtmp output.
Nginx and wowza accept multichannel audio rtmp as can be checked directly.

Here is a capture of ffmpeg streaming in 7.1 rtmp to a wowza server.






As an aside, it would be nice to port the multichannel ability not only to the streaming module but also the recording one for people using sdi capture cards with embedded audio (and hopefully some day obs will support asio on windows).


----------



## pkv (May 27, 2017)

I played with the code and it can be done and works;

https://github.com/pkviet/obs-studio/branches
(multichannel branch)

Streaming in rtmp / mpeg-ts  both work with multichannel audio (tested with 7.1 audio). I checked by dumping the streams with ffmpeg into mp4 or ts files.
Recording also work in multichannel audio (7.1 again).

I haven't yet pulled a request to main repo because my additions need some more cleaning.


----------



## Camilo625 (Jun 18, 2017)

Hi, i have been looking for something like this for quite a few days now, i would like to be able to record 5.1 or 7.1 surround sound along with gameplay while streaming in stereo (without having to record externally as i'm doing now), is there any way to test this build without having to build it from github?


----------



## pkv (Jun 18, 2017)

My build record and streams in multichannel; but if you stream in multichannel to a cdn, I am pretty sure only the first two channels will be taken; there won't be any downmixing.
I'll try to change that so that when streaming there is an option to downmix.
If you're interested in testing, pm me your email with the OS (win, osx ), i'll post you a link to an installer (the build does not include browser extension and is 64 bit only, I did not compile for 32bit nor with browser)


----------



## pkv (Jun 18, 2017)

YT live keeps only the last two channels; FB live seems to downmix; didn't test twitch, I don't have an account
edit: opened a twitch account to test ; Twitch downmixes all channels so this is perfect !


----------



## Gian (Jan 1, 2018)

I’ve been trying to get 4.0 (ambisonic) sound to Facebook 360 but everyone here tells me it rtmp is stereo only. How can I try your build, if it’s available?


----------



## pkv (Jan 1, 2018)

you can either wait until next official release since my surround sound PR was merged, or you can test a build from my repo:
https://github.com/pkviet/obs-studio/releases
Be aware that the 4.0 encoding works perfectly with rtmp but the FB live 360 is not yet working perfectly; last time I tested, the recording had the 4 ambisonics channels but during the live it was not so: maybe an issue with my browser, I don't know. Engineers from FB spacialaudio have tested my build and for them 4.0 was working, so I can't tell.


----------



## Gian (Jan 5, 2018)

Great thanks I’ll give it a try!


----------



## pkv (Jan 5, 2018)

to be more accurate: i was talking of the recording FB does; when you stream, during the live I didn't have the 4 channels, no spacialization. But the recording of the same stream on FB did have ambisonics 4.0.
Maybe it is fixed now or depends on the browser; can't tell , didn't investigate the issue


----------



## Damien Paul (Jan 7, 2018)

I'd be interested in giving it a try.  I'm specifically interested in the mixdown capabilities.  I've been working on music-related streams with multiple audio inputs.  I have a Focusrite 18i8 that i use for recording that I'd like to test this out with.


----------



## pkv (Jan 8, 2018)

check on the link I gave above and download per your platform. The builds for macOs can be finicky; the main release has 16 channels but for some macs there were install issues (installs fine on latest macs, don't know why older macs have issues). There is pre-release with 8 channel support which installs on older macs  in case the release fails to install.
If you're patient enough, my PR was merged into master so surround will be official in next release.


----------



## Gian (Jan 9, 2018)

I tried your build, works great but I have the same problem as you: 360 audio works only on the recorded video, not during livestream. I tried with Chrome on Win10 and Safari iOS so i think the problem must be on Facebook side.


----------



## pkv (Jan 9, 2018)

i'll ping the fb engineers i'm in contact with


----------



## pkv (Jan 9, 2018)

@Gian can you post a log so that I know the os , the build etc ?


----------



## Gian (Jan 9, 2018)

here we go.


----------



## pkv (Jan 9, 2018)

that's not a log from one of my builds and therefore it's not setup to 4.0 but never mind, i have the os , cpu, cg .


----------



## Gian (Jan 9, 2018)

oops sorry I opened the wrong one


----------



## Gian (Jan 9, 2018)

here's the log from your build. I have a very bad high pitched crickets noise happening with your build when I use my Zoom H2n. doesn't happen in normal build or other applications.


----------



## pkv (Jan 9, 2018)

mmh, odd; i noticed you're encoding three channels (2.1); how many channels are captured by your zoom ?


----------



## Gian (Jan 9, 2018)

that 3 channel encode was just a test to see if the noise went away, it is the same with 4 channels. The zoom records 4 channel, of which the 3rd is silent because it doesn't have vertical spatialization data.


----------



## pkv (Jan 9, 2018)

what was the device with which fb live 360 recording worked ?


----------



## Gian (Jan 9, 2018)

it was the same mic but with the "standard" OBS version (didn't realize I opened the wrong one) . I think even though I could hear the audio turning in the recording it was not real spatialization, just stereo


----------



## pkv (Jan 9, 2018)

just tested live 360 and now both live and record have 4 channels. Can't check if this is proper ambisonics 4.0 order 1 though or if there is some downmixing. The ingest rtmp has 4 channels and after that , what fb live 360 is doing with the channels, i can't tell.
I tested with a media file with four channels.
You could try that too.


----------



## pkv (Jan 14, 2018)

fb live 360 engineers tell me live now works with chrome at least.


----------



## Ambisonic_7.1 (Oct 29, 2019)

Hi all. I just want to capture 7.1 surround sound (especially 4.0 ambisonic) data via games, dvdfab 5 playback, Reaper, etc. I downloaded pkv's music edition of OBS because I cant get the standard OBS to see more than 2 channels even though all of my settings are 7.1 from the control panel all the way to OBS including the bitrate at 1024 for the tracks, etc. I really would appreciate any help capturing in 7.1 and 4.0 Ambisonics. I would be overjoyed. Please help


----------



## pkv (Oct 29, 2019)

well, it does work both in my fork and official obs; I wrote the surround sound support in official obs-studio, just expanding it to 16 channels. The ambisonics part was tested on FB live 360 by me and others. For support, the best is to show up on obs-studio discord server and ping me : @pkv


----------



## Ambisonic_7.1 (Oct 29, 2019)

pkv said:


> well, it does work both in my fork and official obs; I wrote the surround sound support in official obs-studio, just expanding it to 16 channels. The ambisonics part was tested on FB live 360 by me and others. For support, the best is to show up on obs-studio discord server and ping me : @pkv


Thank you!! Will do later today!!


----------



## Ambisonic_7.1 (Oct 30, 2019)

Ambisonic_7.1 said:


> Thank you!! Will do later today!!


Whats your 4 digit tag after "pkv"...? Im kid_gluv#4526


----------



## Ambisonic_7.1 (Oct 30, 2019)

I found ya nevermind. Pinged ya


----------



## Ambisonic_7.1 (Oct 30, 2019)

Ambisonic_7.1 said:


> I found ya nevermind. Pinged ya


Im simply trying to capture internal sound from the gameplay on my pc or whatever media player, DAW playing ambisonic or 7.1 audio. obs only sees 2 channels active the other 6 are inactive but there is clearly audio in my headphones at 7.1 or ambi


----------



## pkv (Oct 31, 2019)

issue fixed with Ambisonic_7.1; some windows settings for his device needed to be changed .


----------



## mt2-knight (Nov 5, 2019)

Hi there, 

Seeing as this thread is still active i'd like to jump in here to see if anyone has any applicable experience and can potentially help me with my implementation.

I'm currently in a research cycle where I am investigating the feasibility of live streaming immersive audio for VR with a particular interest in achieving a resolution above 1OA, i'm keen to see if this version of OBS can help me achieve this.

Has anyone here had any experience with the particular workflow i describe and if so would you be able to share your findings?!

Cheers,

M


----------



## pkv (Nov 5, 2019)

@mt2-knight Just test with FB live 360; 1st order ambisonics should work oob (though admittedly I haven't checked recently)
edit: you can use the obs regular release or my fork. Wont make any difference as far as 1OA are concerned. You can do higher order with my fork though.


----------

