-
Notifications
You must be signed in to change notification settings - Fork 21
Home
This is a fork of OBS-Studio bringing support of surround sound streaming and recording.
The Dynamical Variable Bitrate feature of OBS Classic (by R1CH) has also been ported to OBS-Studio.
Vanilla OBS-Studio can capture audio from multichannel audio sources but downmixes them to either mono or stereo.
This fork does not downmix a surround audio source but streams or records all the audio channels.
This is obviously interesting for live streaming for music concerts, games and all situations where sound spatialization is relevant (e.g. ambisonics). With additional technology (discussed in this wiki), it can be useful also for multilingual streaming which is the reason why I developed this set of features actually.
Are there any services or players which are compatible with surround sound streaming ? YES.
As of now, the following services have been tested and are compatible with live surround sound streaming:
- Twitch,
- Mixer (rtmp not ftl),
- Smashcast ...
Surround sound is not as yet compatible with neither Facebook Live nor YouTube Live (only the first two channels are kept).
However it should work with Facebook Live 360 for ambisonics streaming (at least for order 1 ambisonics; others untested)
-
Recording and Streaming multichannel audio sources (surround sound).
-
Compatible streaming services: Twitch, Mixer rtmp (not ftl), smashcast, FB 360 live
-
Compatible protocols:
- rtmp
- mpeg-ts tcp udp (others untested).
-
Streaming servers tested:
- wowza,
- nginx-rtmp
(rtmp with multichannel audio passes through and can be distributed by these servers to another service or cdn supporting surround sound; however, the recording feature of these servers does not work; only the first two audio channels are kept).
-
html5 players tested and working with live surround:
- videojs,
- bitmovin,
- mediaelement,
- viblast (hls & dash),
- hls.js
-
Compatible containers (for recordings):
- mkv
- mp4
- ts
- flv (others untested).
-
Compatible codecs:
- ffmpeg aac (native encoder, up to 16 channels),
- libfdk_aac (up to 7.1),
- core audio aac (up to 7.1),
- opus (libopus encoder, up to 255 channels),
- vorbis (up to 7.1),
- pcm (others untested).
-
OS: compatible with win, macOS, linux (alsa, pulse-audio).
-
Misc:
- Higher audio bitrates (up to 1024 kbs) unlocked to accomodate higher number of channels.
- all the features of OBS-Studio have been retained; regarding audio: audio monitoring, audio filters, VST are all working OOB.
- Dynamical Variable Bitrate: this was an experimental feature developped by R1CH which was not ported to OBS-Studio. So I ported it because I need it. I have used also some optimizations by Woodbyte. The feature works. The algo could probably be improved. I found that frame dropping can interfere a lot so a switch to disable frame dropping has been added (more on this below in Usage section).
For more info and guides on using OBS-Studio, please refer to Obs-Studio website and its wiki.
Multichannel audio :
- Settings > Audio : check the box 'Advanced: enable Multichannel Audio Recording and Streaming'
- This will add multichannel entries in the Channels list. Select the relevant channel layout (ex: 7.1 or 5.1)
- IMPORTANT: make sure to select the same channel layout as your input (if you have a 4.1 audio source do not select 7.1). If you don't, channel mixing may (or may not) occur. There is an automatic channel rematrixing when either downmixing or upmixing is mandated by a difference in channel layouts between source and output. This channel rematrixing mixes channels in general. Or it can remove a channel (ex: 7.1 source to 8.0 output removes the LFE channel).
- standard rtmp streaming: works out of the box.
- rtmp or mpeg-ts streaming with aac or opus from ffmpeg :
- Go to Settings > Output > Output Mode: Advanced > Recording tab > Custom Output (FFmpeg) > FFmpeg Output Type: Select Output to URL .
- Container format: mpegts or flv (for rtmp).
- audio encoder settings:
- if encoder is aac (for mpegts or rtmp): the channel_layout needs to be specified for 8.0 , type the option channel_layout=octagonal (to avoid ffmpeg confusing it with 7.1);
- if encoder is libopus (only for mpegts): for 8.0 and 16.0 channel layouts, type the option mapping_family=255
- beware, there are two opus encoders: libopus and opus (native ffmpeg encoder); use libopus only.
Dynamical Variable Bitrate:
- What this feature does : it lowers the bitrate of the x264 video encoder whenever stream congestion is detected. When the congestion ends, it increases the bitrate up to its initial value.
- Settings > Output > Output Mode: Advanced
- Streaming tab > check box 'Dynamic Variable Bitrate'
- OBS-Studio has a frame dropping feature which activates when stream congestion is detected; it can work along the Dynamical Variable Bitrate which activates earlier when a congestion is detected. Or it can be disabled if one prefers so for some reason. If frame dropping is enabled (default), the client player will miss obviously some frames. If frame dropping is disabled, the client player will experience frozen frames and maybe accelerated frames. In my case-use where continuity of the stream is paramount, frozen frames are not an issue while dropped frames are.
- To disable frame drops: Settings > Output > Output Mode: Advanced > Streaming tab > check box 'Disable Frame Drops'
For issues strictly related to surround sound streaming or recording, the Issues section can be used.
Check first with regular OBS-Studio release whether you get the same problem or not. If you do get the same issue, open a ticket in OBS Mantis ; if you don't, then post here in Issues Section.
I'll try to keep the releases in sync with Vanilla OBS-Studio at least for the time being (until someone else is motivated to do it in my stead).
The releases will be for win x64 (no win32) and macOs; for linux, people should follow the build instructions given in OBS-Studio website or wiki.
All the releases include the browser module, surround sound and dynamical variable bitrate.
Follow the build instructions in Vanilla OBS-Studio wiki.
BEWARE:
- compile branch multichannelaudio (will have all multichannel capabilities) and NOT branch multichannel (early attempt)
- in order to have dynamical variable bitrate, compile branch multi_dynamic (has both multichannel and variable bitrate)
Up to 7.1 channel layouts, regular ffmpeg will work for aac; for recording opus + mkv, up to 255 channels will work with mapping_family option.
In order to enable 8.0 and 16.0 aac and mpeg-ts + opus streaming for up to 255 channels, a patched ffmpeg is necessary. The patches I wrote for opus are still under review with ffmpeg-devel ML.
The aac patch can be found on my ffmpeg repo (aacdev branch) ==> it has been incorporated in ffmpeg master branch so for aac encoding you just need to compile ffmpeg git head.
The mpegts+opus patch can be found in the opusdev branch.
However the binaries provided here do include these patched ffmpeg.