pkviet / obs-studio

OBS - Free and open source software for live streaming and screen recording
https://obsproject.com/mantis/
GNU General Public License v2.0
151 stars 20 forks source link

Ambisonics to FB live 360 #4

Closed popachi closed 6 years ago

popachi commented 6 years ago

Try as I might I can't get the proper 4 channel ambix audio out of your version of OBS - I can confirm I'm sending 4 channels into OBS from my DAW (Reaper) via Soundflower 64ch, but when I am streaming to FB live I seem to only get 2 channels. When I make a recording to check I see the same issue in the resulting video file - just the first two channels are in use. Please help!

pkviet commented 6 years ago

can you copy your log to pastebin (https://pastebin.com/) ? quad is working on my side on win x64; i'll check later with reaper and soundflower on macOs. You did enable quad in settings > audio , right ?

pkviet commented 6 years ago

On my side I can confirm recording works for quad with soundflower + reaper. I did the following:

pkviet commented 6 years ago

Retested FB live 360 with order 1 ambisonics (quad). The FB recording does have the 4 channels.

popachi commented 6 years ago

Thank you very much for your diligent and speedy response. I've definitely set the audio settings to quad 4.0. The only differences it seems between the setup you described and what I've got going on is that on my 4 channel master I'm making a 4 channel hardware output directly to ch 1-4 of soundflower 64, and didn't bother to set the speaker output as quadraphonic with audio midi setup.

is it a requirement that the speakers are set up in that way in audio midi setup?

what's more bizarre, is that when I use a previous 4channel ambix recording instead of the ambix I'm generating with facebook spatialiser, it seems to go through to fb just fine.

also it's strange that fb live is working for you because I've been in touch with the dev team over there and they've recognized that there are a couple bugs with live streaming ambix.

https://pastebin.com/AZKKubkU

Thanks again!

popachi commented 6 years ago

When recording the stream in OBS I can confirm that only the first two channels are going through. I'm monitoring the output in reaper to the first 4 channels of soundflower and everything looks OK, and the meters are moving in OBS, but the output seems to still be just the first two channels, even though my OBS recording has 4 audio channels.

pkviet commented 6 years ago

1) from your log , you're using coreaudio encoder while I'm using ffmpeg aac encoder (I'm also on high sierra 10.13.1 , not sure if it makes any difference); normally coreaudio should work with 4.0 quad ; I'll have to test if there's been a regression with the core audio encoder. Not sure also if coreaudio he-aac (which you're using in your log) would work. So for the time being: test with a bitrate higher than 320 kbs : this will ensure that ffmpeg aac native encoder is used instead of coreaudio . For 4 channels this means 80 kbs / channel at least. In the logs you should have this line: [FFmpeg aac encoder] bitrate: 512, channels: 4, channel_layout: 33 (the layout 0x33 is quad = FL FR BL BR ) This shows that ffmpeg does encode 4 channels.

2) for FB live 360 with spacial audio, my recording from a live stream does have 4 channels (downmixed to stereo which is the case for all FB live 360, the weight being live controlled by your moves in the video; I can tell easily because my channels are marked vocally, channel 1, channel 2 etc). However during the live itself, I am hearing only the first two channels although FB keeps track of everything. Not sure if it is normal or a defect. Actually I tested FB live 360 with ambisonics today for the first time, it had been reported to me as working for quad by Hans, who's a FB engineer on spacial audio.

popachi commented 6 years ago

Thanks so much for your response!

Hm OK I definitely see a difference when a higher audio track bitrate is used - but now if I make a recording there are still only 2 channels recorded but they show up on tracks 2 and 3. I put the bitrate at 512 and then at 1024 and had the same result both times.

https://pastebin.com/uv4CPj6b

popachi commented 6 years ago

PS Hans is my main contact at FB as well! Great guy. He's telling me that there are some issues on some platforms. Thanks again! -Andrew

pkviet commented 6 years ago

ok i tested with core audio (albeit on win x64, will retest later on macos), no issue; it's also working. So I am wondering if it is not the routing you're making from reaper to obs studio. My setup is four tracks receiving a mono signal ; each track is routed to a hardware output (soundflower 1, 2 , 3 and 4 respectively). You do have the same setup ? Did you select input or output audio capture on OBS ? It worked only with output capture in my case. Regarding monitoring, be careful, the levels you are seeing are only for the first two channels. That's a limitation of the monitoring. Lastly: why do you say your files are only stereo ? if I read with vlc, I only get two channels unless on windows I tune the audio output for multichannel. To check the real state of the file I proceed like this: ffmpeg -i file Will tell you if it is stereo or quad or whatever Then I create a multistream mkv from the multichannel file:

ffmpeg -i 'file -filter_complex "[0:a]pan=mono|c0=c0[a0];[0:a]pan=mono|c0 =c1[a1];[0:a]pan=mono|c0=c2[a2];[a:0]pan=mono|c0=c3[a3]" -map 0:v -c:v copy -map [a0] -c:a pcms16le -map [a1] -c:a pcm s16le -map [a2] -c:a pcm_s16le -map [a3] -c:a pcm_s16le test.mkv

When you open the final mkv with vlc for instance, you will have 4 mono tracks which you can select instead of a single track (but with multichannel). I then listen at each track to check audio is correct.

popachi commented 6 years ago

I'm generating spatial audio with facebook spatial audio workstation, which I'm then converting to 4ch bformat ambix, and sending out the master output of reaper (4ch) to soundflower 64ch channels 1-4

I'm not exactly sure what you mean by "select input or output audio capture" - I see options for standard and custom output, but no place to select input or output audio capture. I'm not monitoring in OBS, I'm monitoring in Reaper

What is happening with the output of the recordings (and I'm assuming with the streaming too) is that two of the four channels of audio are completely empty. When I first brought my issue to you it was channels 3 and 4 (there was audio on channels 1 & 2) but now after changing the bitrate of the audio I'm seeing no audio on channels 1 & 4 (there seems to be the same audio from 1 & 2 before now on channels 2 & 3)

I'm splitting the audio from the video and pulling it back into reaper to take a look at the waveforms, and that's when I'm seeing empty audio tracks. I'm not trying to watch the videos at the moment (which have been movs, not mkv)

pkviet commented 6 years ago

ok, in obs: in the front panel: sources > click on + to add a source > popup: select audio output capture is that how you select the soundflower audio ?

pkviet commented 6 years ago

In your logs, among the sources for the scene I don't see the soundflower device; I am assuming that you are using desktop audio devices in Settings > Audio. Try with Audio Output Capture on the front panel instead and disable the Desktop Audio Device. I am not sure they are working properly on macOS for multichannel, never used them.

popachi commented 6 years ago

Ok switched to using audio output capture and still get the same result: screen shot 2017-11-15 at 1 26 09 pm

2017-11-15 13-25-29.mov.zip

popachi commented 6 years ago

That should be a recording of me saying "front, right, back, left" panned to those directions in fb spatialiser

pkviet commented 6 years ago

One thing I don't understand is that in line 10 in your logs the version is OBS 0,0,1 ; while I have 20,1,1 on my logs (OBS 20.1.1-10-g748fdfa3-modified (mac) ). Which binary are you using ? Did you compile it or are you using mine ?

Secondly, on reaper, did you setup the routing as in the picture ? screen shot 2017-11-15 at 20 01 19

pkviet commented 6 years ago

one thing also which I find puzzling in your logs is that you have two tracks (track 1 and track 4); which one are you using for streaming ? If your 4 channels are coming on track 1, you need to activate track 1 on the Output > Streaming page (click on the picture to enlarge it): capture

Media source is my quad channel audio ==> assigned to Track 1 (click on the cog wheel in the central Mixer panel) At the same time, Settings > output > advanced > streaming tab ==> track 1 .

You must make sure that all your channels are going to the same track. For streaming, a single track can be chosen. For recording, one can mix all 6 possible tracks.

popachi commented 6 years ago

That all checks out. my soundflower 64ch output is assigned to track 1 and the output is track 1 for recording and streaming

pkviet commented 6 years ago

ok and which binary are you using ?

popachi commented 6 years ago

re: binary I compiled your multichannel branch from source about to send you a screenshot of my reaper setup

pkviet commented 6 years ago

Could you try with my latest binary ? this will provide a similar basis with the same ffmpeg libraries

pkviet commented 6 years ago

careful also: the multichannel branch is an early one; the right branch is the multichannelaudio one ... The binaries are using another branch again which incorporate dynamical variable bitrate (branch multi_dynamic)

popachi commented 6 years ago

screen shot 2017-11-15 at 3 03 43 pm

here you can see my routing matrix. I have 4 channels of audio going out to soundflower

popachi commented 6 years ago

Would you please send me a link to the binary I should use? or a zip of everything?

pkviet commented 6 years ago

it is in the Release section (take the last binary):

here

popachi commented 6 years ago

Installed, but now obs won't open! "Failed to find locale/en-US.ini" then "Failed to load locale"

pkviet commented 6 years ago

ha ha, Hans had the same issue; it's a classic issue with OBS; it's a conflict between previous settings and the new one, you have to erase the obs-studio settings folder (in ~/Library/Application Support/obs-studio )

popachi commented 6 years ago

Erased that folder and the one in my user folder library but still getting the same issue

popachi commented 6 years ago

after I click on OK on the license agreement window it crashes

popachi commented 6 years ago

on reopen I get the "Failed to find locale/en-US.ini" then "Failed to load locale" messages

pkviet commented 6 years ago

there are people complaining regularly on obs forum with exact same issue; the solution is to erase the settings folder, so I'm at a loss. This error occurs on mac, win or linux for the exact same reasons.

see for instance:

https://obsproject.com/forum/threads/obs-crashes-at-startup-osx-sierra-10-12-3.65610/

And:

https://obsproject.com/forum/threads/obs-crash-mac-failed-to-find-locale-en-us-ini.67234/

Also:

https://obsproject.com/forum/threads/problem-with-macbook-and-obs.65601/

pkviet commented 6 years ago

the package installs fine on my mac (high sierra updated today to 10.13.1)

popachi commented 6 years ago

reinstalled twice, restarted the system, deleted the folders again. same issue

popachi commented 6 years ago

completely broken now

sudo /Applications/OBS.app/Contents/MacOS/OBS Password: info: CPU Name: Intel(R) Core(TM) i5-2500S CPU @ 2.70GHz info: CPU Speed: 2700MHz info: Physical Cores: 4, Logical Cores: 4 info: Physical Memory: 16384MB Total info: OS Name: Mac OS X (NSMACHOperatingSystem) info: OS Version: Version 10.12.4 (Build 16E195) info: Kernel Version: 16.5.0 info: hotkeys-cocoa: Using layout 'com.apple.keylayout.US' info: Portable mode: false QMetaObject::connectSlotsByName: No matching signal for on_advAudioProps_clicked() QMetaObject::connectSlotsByName: No matching signal for on_advAudioProps_destroyed() info: OBS 20.1.1-10-g748fdfa3-modified (mac) info: --------------------------------- info: --------------------------------- info: audio settings reset: samples per sec: 44100 speakers: 2 info: --------------------------------- info: Initializing OpenGL... info: OpenGL version: 4.1 ATI-1.50.38 Illegal instruction: 4

popachi commented 6 years ago

seems to crash when initializing Open GL?

https://pastebin.com/hEcFJrT2

pkviet commented 6 years ago

that's really weird, I had these issues occasionally after compiling new builds; but erasing the settings folder always solved the issue; I'll discuss with other obs dev if they have clues

pkviet commented 6 years ago

can you try installing regular obs (same version 20.1.1 ) ? see if it starts, after that try re-installing my fork

pkviet commented 6 years ago

from a discussion with Fenrir (one of the devs), he's seen this bug for months for some people on mac; but the cause is not yet clear, might be related to QT. Indeed there is a warning from QT in your latest crash message

<pkv> hi I am troubleshooting someone with crash at startup due to : Failed to find locale/en-us.ini ; I've had occasionally the error upon installing new builds and I solved it usually with erasing previous settings. This doesn't work for the person I'm troubleshooting, there seems to be some oepnGl error (on macos 10.12.4, ati video card). Does someone have a clue ? [22:31] <Fenrir> mac, right? [22:31] <Fenrir> I have seen that for weeks.
[22:31] <Fenrir> months, actually.
[22:31] <c3r1c3-Win> Actually that's only true of NVidia. AMD's AMF uses resources on the GPU (shader units) and same fro most versions (if not all) of QSV.
[22:31] <Fenrir> I have absolutely no idea.
[22:33] <pkv> really weird
[22:33] <Fenrir> pkv: If you delete/move the settings directory, it should start working again
[22:34] <Fenrir> The crash logs make no sense either, they're crashes somewhere in Qt, right?
[22:35] <pkv> well, that's the thing, deleting the folder in his case does not solve things
[22:36] <pkv> oh right, there's indeed a message about QT
[22:36] <Fenrir> I've been trying to figure this out for over a month :(
[22:36] <Fenrir> I can't find any kind of common thread
[22:36] <Fenrir> Seen it on pretty much every version of macOS 10.11+

popachi commented 6 years ago

I tried installing regular obs - no dice. So some people on mac just cant use OBS for a while? I have a live Facebook broadcast on Friday and I really need at least the ability to stream stereo by then...

pkviet commented 6 years ago

might be related to QT; when you built your own obs version, how did you install QT ? with brew ?

alternative softwares: you could use flash live media encoder (free); or if you have bootcamp, try on your windows partition

pkviet commented 6 years ago

can you put on pastebin the crash report generated by macOS ? I'll forward to Fenrir

popachi commented 6 years ago

I built from the source of your newest version and was able to then open OBS

most recent log: https://pastebin.com/5ze3p7Gt

don't have a crashreport because during my last reinstall/build I completely wiped any and every OBS related file on my computer, and I think the crash reports were included

pkviet commented 6 years ago

ok great; hope it will work now

popachi commented 6 years ago

oh, no, unfortunately same issues as before. 4 channels coming out of the recording but only two of them are actually audio.

popachi commented 6 years ago

screen shot 2017-11-15 at 6 50 07 pm here is a screen shot of the output audio

popachi commented 6 years ago

monitoring the output of Reaper to Soundflower by adding another track with soundflower as input. clearly can see all four tracks are being sent to soundflower screen shot 2017-11-15 at 6 51 10 pm

pkviet commented 6 years ago

that's crazy; if you followed the build instructions from the wiki, they're not the most complete. You can try to use the following scripts: 1) obs-studio/CI/install-dependencies-osx.sh (remove on line 7 unshallow, you can remove also the deps for the browser and/or vlc if you want to accelerate later building)
2) obs-studio/CI/before-script-osx.sh 3) cd build && make -j4 4) you'll have then a binary in build/rundir/realeaseWithDeb/bin which you can execute

popachi commented 6 years ago

what do you mean by step 2? removed "--unshallow" from line 7 in step 1

pkviet commented 6 years ago

The first script uses brew which you install with :
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

popachi commented 6 years ago

i have brew installed already

pkviet commented 6 years ago

step 2 is execute the script before-script-osx.sh (it runs cmake basically)