100 Commits
Author SHA1 Message Date
pkvandRyan Foster a00854666f nv-filters: Remove direct calls to CUDA in Audio FX
The CUDA calls in AUDIO FX were added initially to big a bug on the SDK
side where the SDK functions where not checking the CUDA context.
This led to interference with the VIDEO FX, potentially breaking it.
These bugs have been fixed by the SDK so we don't need anymore these
CUDA calls.

Signed-off-by: pkv <pkv@obsproject.com>
2026-07-01 17:37:45 -04:00
pkvandRyan Foster 68f5470d15 libobs: Monitoring deduplication fix for 'Desktop Audio' on monitor_only
When an Audio Output Capture source (AOC) like 'Desktop Audio' has
monitoring_type == OBS_MONITORING_TYPE_MONITOR_ONLY, deduplication
should not be triggered. this is an edge case which may not cover a
reasonable use case, but for the sake of completeness, we deal with it.

Signed-off-by: pkv <pkv@obsproject.com>
2026-04-01 14:29:25 -04:00
pkvandRyan Foster 65afc7ae36 nv-filters: Skip Blur filter for HDR
The HDR support is removed from the full blur FX but kept for Background
Blur and Greenscreen FX.
The Blur FX is SDR only but for Background Blur it can be tolerated
since the foreground is not touched.

Signed-off-by: pkv <pkv@obsproject.com>
2026-01-14 12:01:46 -05:00
pkvandRyan Foster 1c24881f07 nv-filters: Remove stage image for Video FX
When transferring images within the GPU, there is no requirement to
create stage images.

Signed-off-by: pkv <pkv@obsproject.com>
2026-01-14 12:01:46 -05:00
pkvandRyan Foster 616098543e nv-filters: Fix banding issues with Blur effects
We were giving images to the Blur effect in linear color space.
This caused a darkening of colors with banding effects.
This fixes the issue.
For Background Blur FX, we composite the original texture with the
blurred one using the mask provided by AI Greenscreen.
This means the non blurred area will look the same whether the filter is
applied or not, irrespective of OBS settings and the nature of the
source. For both HDR & SDR this preserves the colours in non blurred
zones.

Signed-off-by: pkv <pkv@obsproject.com>
2026-01-14 12:01:46 -05:00
pkvandRyan Foster ad4315b15a libobs: Fix default macOS monitoring device
The default device retrieved was the one used for system sounds.
This fixes it by retrieving the one used to output audio.

It seems the bug has been there since the initial writing of this bit of
code (so 2017).
2025-12-12 15:21:42 -05:00
pkvandRyan Foster f86861cc8d linux-pulseaudio: Add monitoring deduplication calls
For 'pulse_output_capture', calls are added when devices are either
changed, started or removed.

The calls trigger a check against the monitoring device.

Signed-off-by: pkv <pkv@obsproject.com>
2025-12-12 15:21:42 -05:00
pkvandRyan Foster d4ef5ef2d7 mac-capture: Add monitoring deduplication calls
For 'coreaudio_output_capture', calls are added when devices are either
changed, started or removed.

The calls trigger a check against the monitoring device.

Signed-off-by: pkv <pkv@obsproject.com>
2025-12-12 15:21:42 -05:00
pkvandRyan Foster d9b5addf72 win-wasapi: Add monitoring deduplication calls
For 'wasapi output capture', calls are added when devices are either
changed, started or removed.

The calls trigger checks against the monitoring device.

Signed-off-by: pkv <pkv@obsproject.com>
2025-12-12 15:21:42 -05:00
pkvandRyan Foster 91917f8120 libobs: Improve monitoring deduplication
The monitoring deduplication was previously checking at each audio tick
the whole audio tree for Audio Output Capture (AOC) devices used for
monitoring. The profiling did not show any big impact on the audio
callback. But due to reports of a significant slowdown for scenes with
numerous audio sources, we have moved the check on AOC from the audio
thread to the UI thread.

So we implemented obs_source_audio_output_capture_device_changed which
is triggered whenever:
- a monitoring device is changed in Settings > Audio,
- an Audio Output Capture source changes its device or on startup.

This function compares the AOC device with the monitoring device in UI
thread. If they are identical, a signal is sent to the audio thread to
add an audio task updating the AOC duplicating source pointer at the end
of an audio tick.

This triggers monitoring deduplication if the ptr is not NULL.
The calls in the AOC are implemented in next commits.
The rest of the logic in obs-audio.c is the same except on one count,
which is that we check against the muted state of the AOC rather than
its user_muted; with the new logic, muted works better.

Signed-off-by: pkv <pkv@obsproject.com>
2025-12-12 15:21:42 -05:00
pkvandRyan Foster 4ea2074eed libobs: Add devices_match to null monitor
This adds the devices_match function to null monitor to fix linking
issues on linux when pulse audio is disabled.
Fixes #12810

Signed-off-by: pkv <pkv@obsproject.com>
2025-11-26 14:16:53 -05:00
pkvandRyan Foster eb4161e72e libobs: Monitoring deduplication for default devices
This adds comparison to default devices to the monitoring deduplication.
When a user picks a default device, the device_id setting is 'default',
which prevents any comparison.
The comparison is done by leveraging the libobs/audio-monitoring
devices_match function.
For macOS, some special care is taken because the devices list differ
for 'Desktop Audio' and 'monitoring' since coreaudio sdk has no pure
audio capture; so 'default' in the two lists do not match in general.
One then retrieves the device_id for the default desktop audio for macOS
through get_desktop_default_id function.

Signed-off-by: pkv <pkv@obsproject.com>
2025-11-11 13:55:34 -05:00
pkvandRyan Foster 2f2c66a597 libobs: Enable retrieval of macOS default audio output capture device
This allows retrieval of the default audio output capture device.

Signed-off-by: pkv <pkv@obsproject.com>
2025-11-11 13:55:34 -05:00
pkvandRyan Foster 189ed7c386 libobs: Trigger monitoring deduplication when fader is at minimum
When the 'Audio Output Capture' source (usually Desktop Audio) has its
fader at minimum, we should disable the deduplication logic.
This is done by checking against the obs_source volume member.

Signed-off-by: pkv <pkv@obsproject.com>
2025-10-30 13:27:54 -04:00
pkvandRyan Foster af17e71dd1 libobs: Additional monitoring deduplication check with pulse
Pulse audio may append .monitor to device id; this commit adds this case
to the deduplication trigger.

Signed-off-by: pkv <pkv@obsproject.com>
2025-10-30 13:27:54 -04:00
pkvandRyan Foster 967e19b3fa libobs: Check tracks for monitoring deduplication
Monitoring deduplication must be applied only to tracks for which the
monitored source and the 'Audio Output Capture' source are both enabled.
This adds such checks.

Signed-off-by: pkv <pkv@obsproject.com>
2025-10-30 13:27:54 -04:00
pkvandRyan Foster 9696f54937 libobs: Log monitoring audio deduplication
The commit adds a log line to inform the user that deduplication is
being applied. The info is displayed whenever deduplication first
occurs.

Signed-off-by: pkv <pkv@obsproject.com>
2025-09-26 12:12:08 -04:00
pkvandRyan Foster 40dd9f6c5e libobs: Fix for monitoring deduplication edge case
When an 'Audio Capture Source' device is also used for monitoring, the
deduplication logic is applied: all monitored sources are silenced.
But this should not silence the 'Audio Capture Source' if for some
reason, it is being monitored (the user will get echoes, but hey, it's
their choice). So we exclude the 'Audio Capture Source' from the
silenced sources.

Signed-off-by: pkv <pkv@obsproject.com>
2025-09-26 12:12:08 -04:00
pkvandRyan Foster e33eab7f2a nv-filters: Guard function introduced in sdk >= 1.6.0
I forgot to guard NvAFX_UninitializeLogger() called in Destroy function.

Signed-off-by: pkv <pkv@obsproject.com>
2025-09-03 16:43:18 -04:00
pkvandRyan Foster 9bb940acd8 libobs: Fix audio duplication for monitored source
This fixes the following issue:
- when an Audio Capture source (like 'Desktop Audio',
'wasapi_output_capture' or 'pulse_output_capture') and monitoring use
the same device, one gets duplicated audio for any monitored source,
since their audio is added through both the current scene and the output
capture.
This creates a shift in audio level (about 3 dBFS for white noise, and
oftentimes for music; up to 6 dBFS for very low frequency sine waves).
We solve the bug by:
- detecting when an Audio Capture source and monitoring share the same
device;
- silencing monitored sources whenever the Audio Capture source is
unmuted.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 19:48:59 -04:00
pkvandRyan Foster 55c4ca9e63 obs-ffmpeg: Fix crash when using a pkt_size != 1316
This fixes a crash when using a pkt_size which is not the UDP default of
1316 Bytes ( 7 * 188 ).

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 19:07:21 -04:00
pkvandRyan Foster 67b0b44fec obs-ffmpeg: Log SRT listener waiting for a connection
Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 19:07:21 -04:00
pkvandRyan Foster 1407398e7f obs-ffmpeg: Change OBS-OUTPUT-XXX returns for RIST protocol
This updates a few OBS-OUTPUT-XXX to better reflect the output failures
for the RIST protocol.
Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 19:07:21 -04:00
pkvandRyan Foster 467967eab6 obs-ffmpeg: Fix a crash with invalid URL
This fixes a crash when an invalid URL is used.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 19:07:21 -04:00
pkvandRyan Foster 651544a487 obs-ffmpeg: Reimplement reconnection logic in mpegts muxer
This reimplements the reconnect logic in mpegts muxer.
Taking cues from the WHIP output, a start and stop thread is used,
controlled by a mutex, ensuring the start and stop pipelines can never
be run concurrently.
Fixes bugs #11885, #11721, #11620, #11062, #12133.
For better readibility, this commits also breaks the big set_config
function into smaller units.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 19:07:21 -04:00
pkvandRyan Foster 8d9bd44179 obs-ffmpeg: Fix reconnection for SRT protocol
This is the first part of a fix for reconnection issues with SRT
protocol.
This part implements the logic on the side of the protocol.
The fixes are as follows:
- a cleanup of return values of the various functions used. The main
libsrt_open function returns OBS_OUTPUT_XXX enum members. But the other
functions return now only AVERROR(xxx).
- an explicit check of the socket state before returning
OBS_OUTPUT_SUCCESS. This fixes an issue due to relying on socket
non-blocking mode; in caller mode, the srt_connect function will return
a success even before a connection has succeeded since it relies on
notifications by srt_epoll_wait. This would prompt obs UI to display a
successful reconnection in spite of a failure.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 19:07:21 -04:00
pkvandRyan Foster 3ae9d6a106 obs-ffmpeg: Cleanup for mpegts muxer
The do_log function defined for the muxer expects that the struct is
named stream rather than output. So rename output to stream.
This also avoids confusion with stream->output which is an obs_output_t
pointer.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 19:07:21 -04:00
pkvandRyan Foster 50cdabbb5f libobs: Fix audio duplication
This fixes the following bug:
- a source might be copied into the same scene or through a nested scene.
The audio level will then increase by +6 dBFS.
An earlier fix [1] dealt with this bug at the scene audio rendering
level, which leaves some edge cases since the fix is not located
directly in the core audio callback.
The current fix consists in:
- tagging individual sources which appear several times in the audio
tree at each tick;
- promote them to root_nodes sources;
- bypass their mixing in scenes and transitions.
Due to being mixed as root_nodes, the audio of duplicated sources
appears only once in the final audio mix.

[1] https://github.com/obsproject/obs-studio/pull/10537

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 16:01:13 -04:00
pkvandRyan Foster f027f62f90 Revert libobs: Mix audio of each source in a scene only once
This reverts commit: 8a38e33 [1].
This also reverts commit: 72924ac [2].
(in favour of a fix in core audio pipeline, which allows to address
edge cases).

[1] libobs: Mix audio of each source in a scene only once
https://github.com/obsproject/obs-studio/commit/8a38e3375b63692b01e5088d37f531f36a5d39f9
[2] libobs: Deduplicate audio for nested scenes/groups if not
transitioning
https://github.com/obsproject/obs-studio/commit/72924ac1f3c4c55de038fe1f03a0e197a155d5e7

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-22 16:01:13 -04:00
pkvandRyan Foster 164c921006 nv-filters: Remove from video fx header redundant define
These defines were defined twice ... due to a botched rebase.
Formatting fixes too.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster 50b0943cec obs-filters: Purge NVIDIA Noise suppression
This completely removes what remained in obs-filters of NVIDIA FX, which
have been moved to their own project.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster 8ae76937e0 nv-filters: Premultiply correctly for Blur FX
Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster f3ebb86396 nv-filters: Fix for size changes with video fx
The && should be a || when sizes are changed.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster 3baf0456ba nv-filters: For Blur FX, do not set mask image
It is not necessary to set the mask parameter for Blur FX.
Setting it to NULL, will apply the blur to the whole image.
This is not documented in the SDK but is returned when info about the
FX is requested by the plugin to the SDK library.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster ea96f87ca1 nv-filters: Fix load of video FX during reset
The video FX must be reloaded whenever any of its settings have changed,
including its the temporal state.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster ab55bb46ea nv-filters: Set NvVFX_Run to SYNC mode
The NvVFX_Run function can be run in SYNC or ASYNC mode; the SDK sample
uses SYNC. This defines the magic numbers in an enum and sets the
NvVFX_Run function to SYNC.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster 94752762c7 nv-filters: Process Background Blur FX on same CudaStream as Background Removal FX
The SDK samples uses the same CudaStream for both FX. Do likewise which
simplifies the code. (The Background Blur calls the Background Removal.)

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster 2ad236740f nv-filters: Change Background Blur to perf mode
In order to alleviate the demands on GPU, the Background Blur is now set
to Perf mode.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster ffd3a2a34e obs-filters: Remove unused NVIDIA effect
The greenscreen effect was moved to nv-filters project.
But this file failed to be removed.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster cf6eb3fd89 nv-filters: Add chair removal option to background removal
This adds the following new options for background removal effect,
namely the ability to remove the chair or leave it with the talking
head.
Requires sdk >= 0.7.6.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster b9f13cc360 nv-filters: Add voice optimization for audio filters
This adds a new property for the audio filters: VAD (Voice Audio Data).
When it is toggled, the effect will be optimized for voice processing.
Noise suppression will "remove low-volume noise and all non-speech data"
in the words of the SDK.
Requires SDK >= 1.6.0.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster 5c57cb1d8b nv-filters: Enable new logger function for audio effects
This enables a new logger function introduced in SDK >= 1.6.0, which
gives much more details about what is going on during the effect
processing.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster a8b8abe691 nv-filters: Enable new logger function for Video Effects
This enables a new logger function introduced in SDK >= 0.7.5, which
gives much more details about what is going on during the effect
processing.

Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster 5e60e19de3 nv-filters: Disable audio filter instead of destroying in case of issues
The audio filters are now disabled if an issue is detected;
the filter is no longer destroyed.
This avoids a call to destroy function within the filter.
Signed-off-by: pkv <pkv@obsproject.com>
2025-08-21 16:52:14 -04:00
pkvandRyan Foster f6f5c7bb25 nv-filters: Silence initial load error for Blur
On initial run of the Blur filter, some parameters are not all set when
there is the first call to load the effect. This is actually not an
issue, so the log is now silenced at this time.

Signed-off-by: pkv <pkv@obsproject.com>
2025-03-17 16:25:58 -04:00
pkvandRyan Foster cc452e5acd nv-filters: Remove reset signal for Video effects
The reset signal was triggered whenever there was an update in the
parent source. This destroys the effect and recreates it, which can be
resource heavy.
We now let the SDK handle the source update on its own rather than
manually resetting the effect on obs side.

Signed-off-by: pkv <pkv@obsproject.com>
2025-03-17 16:25:58 -04:00
pkvandRyan Foster 3402f6c7d0 nv-filters: Fix CudaStream used in Video effects
During the mapping and unmapping of resources, the CudaStream was not
always consistent.
This fixes the issue.
Thanks to Stephan from NVIDIA Dev support for noticing the mismatch.

Signed-off-by: pkv <pkv@obsproject.com>
2025-03-17 16:25:58 -04:00
pkvandRyan Foster b5d0054cfa nv-filters: Reallocate state when resetting AIGS filters
This properly allocates the temporal state variable used in AI
greenscreen effect, when the latter is reset.

Signed-off-by: pkv <pkv@obsproject.com>
2025-03-17 16:25:58 -04:00
pkvandRyan Foster 2682ccc33c nv-filters: Fix destruction of Background Blur effect
For the background blur effect, it was found that destroying it and
then adding any other NVIDIA effect led to a blank picture.
This commit swaps the order of destroying the effect and the associated
cudaStream.
For other effects the order does not matter; I have no idea why the
order matters for blur effect and the SDK gives no indication about any
proper order at destruction time.

Fixes bug #11383.
Signed-off-by: pkv <pkv@obsproject.com>
2025-03-17 16:25:58 -04:00
pkvandRyan Foster ff51280ecb nv-filters: Set max effective threshold to 0.95 for Background removal
The threshold THR in Background removal filter has the following effect:
- if alpha if between [THR - 0.1; THR], alpha is interpolated;
- if alpha >= THR, alpha is set to 1.0;
- if alpha <= THR - 0.1, alpha is set to 0.
It was introduced in order to smooth the alpha at the edges of the
foreground.
This works fine unless THR == 1, where there can be bulk pixels with
alpha which will be interpolated as if they were at the edge;
in order to ensure that a bulk area with alpha set to 1.0 is well
defined, the max threshold is now set to 0.95 (so if the user picks a
unity threshold, a value of 0.95 will actually be used).
This fixes a bug in third party plugins which rely on a bulk foreground
safely set at alpha == 1.0. [1]

[1] https://github.com/FiniteSingularity/obs-stroke-glow-shadow/issues/61

Signed-off-by: pkv <pkv@obsproject.com>
2025-03-17 16:25:58 -04:00
pkvandRyan Foster d1249cd993 nv-filters: Remove CUDA RT functions
We don't use CUDA RT functions anymore.
So this commit removes their loading from the CUDA RT DLL.
This also fixes a crash when loading different versions of CUDA RT when
the SDK is updated [1].

[1] https://github.com/obsproject/obs-studio/issues/11813

Signed-off-by: pkv <pkv@obsproject.com>
2025-02-05 11:56:51 -05:00
pkvandRyan Foster 417eddfc9d nv-filters: Update SDK version targeted
This updates checks against current SDK redist versions:
- 0.7.6 (Video Effects)
- 1.6.1.2 (Audio Effects)

Users will receive a warning if their redist versions are lower than
these.

Signed-off-by: pkv <pkv@obsproject.com>
2025-02-05 11:56:51 -05:00
pkvandRyan Foster 69a825b71b obs-filters: Maintain order of migrated NVAFX filters
This fixes a bug where the NVIDIA NVAFX filters are migrated but not
kept in their original order, with respect to other filters.

Signed-off-by: pkv <pkv@obsproject.com>
2024-12-10 14:34:48 -05:00
pkvandRyan Foster de2e42b231 nv-filters: Remove unused flag in cmake
This removes the HAS_NOISEREDUCTION flag which is not used in this
plugin.

Signed-off-by: pkv <pkv@obsproject.com>
2024-09-10 14:50:46 -04:00
pkvandRyan Foster 7fdcb166b4 obs-filters: Fix building of noise reduction
If speex and rnnoise are disabled but nvafx is enabled, the noise
reduction filter still needs to be built. This fixes the issue.

Co-authored-by: Ryan Foster <ryan@obsproject.com>
Signed-off-by: pkv <pkv@obsproject.com>
2024-09-10 14:50:46 -04:00
pkvandRyan Foster f9bf7e6c00 obs-filters: Add NVIDIA Blur Filter & Background Blur
This adds a Background Blur filter which blurs the background for a
foreground speaker identified by NVIDIA AI Greenscreen FX.
Secondly, this adds a Blur filter based on NVIDIA Video Effects,
leveraging the Background Blur Filter where the mask used just sets the
whole frame as background.

Signed-off-by: pkv <pkv@obsproject.com>
2024-08-23 15:19:38 -04:00
pkvandtt2468 1451554fb8 obs-ffmpeg: Fix SRT listener bug
Fixes #10504.
There was a bug in FFmpeg implementation which was hidden by a bug in
libsrt; it was fixed in a recent commit [1].
When we ported FFmpeg libsrt.c to obs, we brought the said bug along.
When starting an SRT stream in listener mode, if no connection is made
by a client, there were two issues:
- 1) obs was stuck into a connecting loop,
- 2) the socket was not closed when exiting OBS.
This fixes the issue so that SRT is displaying that a stream started
when in listener mode even if NO client is connected.
This is the correct behaviour for a listener.
The stream now closes properly.

[1] https://git.videolan.org/?p=ffmpeg.git;a=commit;h=87677c2195e86b126c3438439a05d0a46ae5bb50
Signed-off-by: pkv <pkv@obsproject.com>
2024-08-10 01:54:27 -07:00
pkvandRyan Foster 00c495b203 obs-filters: Move NVIDIA filters in their own project
This commit does the following:
1. Factor out NVIDIA Audio Effects from Noise Suppression filter.
2. Move NVIDIA Audio Effects to a new filter in a new nv-filters
project.
3. Migrate Noise Suppression filter settings to the new filter when
NVIDIA Audio effects were used.
4. Migrate NVIDIA AI Greenscreen to the new nv-filters project for
easier maintainance of all NVIDIA Maxine effects.

Context:
 Currently, the three NVIDIA Audio Effects (noise suppression, room
echo removal, noise suppression + room echo removal combined) are part
of the noise suppression filter.
Historically, it's because a lot of code was shared between speex,
rnnoise & NVIDIA noise suppression.
But the NVIDIA code has become bulkier & cumbersome due to:
- addition of other effects;
- addition of a deferred loading thread.
The factorisation makes the code very difficult to maintain for
(un)readability reasons.
This will make it easier to add other audio effects, should we wish to.
Developers life will be easier too when debugging.
The code has been reorganized and comments added.
I also added a mutex in the process_fx function to avoid a crash when
swapping effects.

Signed-off-by: pkv <pkv@obsproject.com>
2024-08-08 15:53:52 -04:00
pkvandLain 19abab097d UI: Fix leak with paint event of volume slider
This fixes a memory leak introduced in [1] where a new QColor is not
balanced by a delete.

[1] UI: Update volume meter appearance
https://github.com/obsproject/obs-studio/commit/52ae5fc4bd518c67edd8ab94121ace05d9076892

Signed-off-by: pkv <pkv@obsproject.com>
2024-08-03 16:27:17 -07:00
pkvandRyan Foster 5b2e2a9c68 libobs/media-io: Fix media-remux channel layout for 5 channels
FFmpeg has 5.0 as default layout for 5 channels.
But obs-studio uses 4.1. This is a fix when remuxing.

Signed-off-by: pkv <pkv@obsproject.com>
2024-05-09 10:27:20 -04:00
pkvandRyan Foster 06e2b31001 obs-ffmpeg: Fix 7.1 ALAC encoding
Commit [1] added ALAC & PCM support.
But 7.1 ALAC encoding fails.
This fixes the issue by assigning the correct 7.1 layout supported by
FFmpeg ALAC encoder (7.1(wide)).

[1] https://github.com/obsproject/obs-studio/commit/3ae98511d09f1ebaf5c9cc005a285efd1a26aeff

Signed-off-by: pkv <pkv@obsproject.com>
2024-05-09 10:27:20 -04:00
pkvandRyan Foster 41f07913e5 deps/media-playback: Fix hardware decoding of streams
Fixes issue #10369.
Since the update to FFmpeg 6.1, streams to a Media Source are broken
if hardware decoding is enabled (both RTMP or SRT have been reported).
The video is black although the audio is decoded fine.
The manual copy of metadata introduced in commit [1] does not work any
more for some unfathomable reasons.
As a fix we call instead the av_frame_copy_props function used in FFmpeg
app in a similar context (hardware decoding) [2].
The metadata are copied without issues.
There is no need to guard the use of that function since it was
introduced 9 years ago in avutil/frame.c.

[1] https://github.com/obsproject/obs-studio/commit/22fde5cdcd1c784cd60b8a8cd50af02e7e537182
[2] https://github.com/FFmpeg/FFmpeg/master/fftools/ffmpeg_dec.c

Signed-off-by: pkv <pkv@obsproject.com>
2024-03-18 14:13:55 -04:00
pkvandRyan Foster 5bd22afe41 UI: Correctly toggle audio multi-track buttons
This toggles audio multi track display in Output settings when:
1. When there is a signal that a stream service is changed to a non
custom one. Indeed multi-track audio is only available with Custom
service and only with SRT or RIST protocols.
2. When a Custom service is picked, and SRT or RIST are detected in the
server URL.
3. When Stream settings are saved when one hits Apply.
This is in addition to the toggling done when loading Stream Settings.

Signed-off-by: pkv <pkv@obsproject.com>
2024-02-27 18:26:09 -05:00
pkvandRyan Foster ef19644e5e UI: Remove LoadOutputSettings from save sequence
This removes the LoadOutputSettings() called in SaveStream1Settings.
It caused a bug when trying to save Output settings when both Stream
and Output settings have been changed but the changes have not been
applied by hitting the 'Apply' button in Settings.

Signed-off-by: pkv <pkv@obsproject.com>
2024-02-27 18:26:09 -05:00
pkvandRyan Foster 60bd03e45e UI: Fix RTMP check in Advanced output
RTMP was not being recognized due to a case-sensitive comparison; this
changes to a case insensitive comparison to fix the issue.
Fixes a bug found in beta channel.

Signed-off-by: pkv <pkv@obsproject.com>
2024-02-06 21:36:37 -05:00
pkvandLain f186268507 UI: Enable audio multi-track w/ mpegts streaming
This enables audio multi-track support in UI for mpegts streams (srt,
rist ...).
The UI changes were coded though to allow re-use by other protocols.

Signed-off-by: pkv <pkv@obsproject.com>
2024-01-06 18:42:54 -06:00
pkvandLain 99ae6eb2e9 obs-ffmpeg: Support multiple audio tracks (mpegts)
This adds support for multiple audio tracks for the new mpegts output.

Signed-off-by: pkv <pkv@obsproject.com>
2024-01-06 18:42:54 -06:00
78a33c7771 obs-ffmpeg: Fix broken mpegts output
This recent commit [1] broke SRT & RIST streaming because
obs_output_video now returns a NULL pointer for encoded outputs.
This fixes it by retrieving the pointer from the encoder.

[1] https://github.com/obsproject/obs-studio/commit/fb57eff212fbe5e777cf559288bc70bf67d9c428

Co-authored-by: tt2468 <tt2468@gmail.com>
Signed-off-by: pkv <pkv@obsproject.com>
2023-08-29 14:44:54 -04:00
pkvandLain 737b21230d obs-filters: Add a mutex when running NVIDIA Audio FX
This fixes a bug when swapping NVIDIA effects.
The update signal triggers a destruction of the previous effect, but the
effect would still run, potentially causing a crash.
The mutex added in the NVIDIA processing function prevents that.

Signed-off-by: pkv <pkv@obsproject.com>
2023-08-19 16:44:11 -07:00
pkvandLain 79232c3cec obs-filters: Update NVIDIA Effects SDK versions
We need to check for new versions of the NVIDIA Effects redistributables
because mismatched versions of the AUDIO and VIDEO sdk can have
different CUDA versions of the deps, which has caused crashes in obs.
It'd be way better that NVIDIA either ships a single installer with both
audio and video effects or that they auto-install with the drivers.
But meanwhile, we provide a warning to users which requires us to keep
in sync with what's released.

Signed-off-by: pkv <pkv@obsproject.com>
2023-08-17 03:37:30 -07:00
pkvandRyan Foster ce6a17e979 cmake: Copy libdatachannel DLL
Copy libdatachannel DLL whether it's compiled on MSVC (and named
datachannel.dll) or cross-compiled on MinGW (and named
libdatachannel.dll).

Signed-off-by: pkv <pkv@obsproject.com>
2023-07-20 10:28:11 -04:00
pkvandRyan Foster 9803582dff build-aux: Update libdatachannel for Flatpak
This updates libdatachannel to the commit supporting simulcast [1]
and removes the now unnecessary libdatachannel patching.

[1] https://github.com/paullouisageneau/libdatachannel/commit/709a66339451bb4c8d4e5ced78c67605ec09da31

Signed-off-by: pkv <pkv@obsproject.com>
2023-07-20 10:28:11 -04:00
pkvandRyan Foster b15fc60d63 obs-ffmpeg: Fix rendezvous mode with SRT
Rendezvous mode with SRT protocol is used to punch through firewalls.
Although caller or listener mode are much more widespread, it is
sometimes in use. The rendezvous mode was broken in obs because we
would bind to the remote IP, instead of a local IP. This fixes the bug.
Note that there is also a bug in libsrt preventing our code to work.
But Version 1.5.2+ of libsrt fixes that.

Signed-off-by: pkv <pkv@obsproject.com>
2023-07-18 15:55:22 -04:00
pkvandLain ba92140f2b rtmp-services: Enforce encoder settings per protocol
For mpegts output, used in rtmp-custom service, encoder settings
require:
- ADTS with fdk-aac.
For all non-rtmp protocols, one also requires:
- video encoder header repetition;
This future proofs the code against protocol addition.

Additionally, I've added a check against NULL audio settings, which was
in my fork but that I forgot to add in the PR [1].

[1] https://github.com/obsproject/obs-studio/pull/6163

Signed-off-by: pkv <pkv@obsproject.com>
2023-06-24 17:11:33 -07:00
pkvandLain 457c88b138 UI: Change surround sound warning to signal YouTube support
YouTube Live now supports 5.1 surround sound.
The surround sound warning in Settings has been updated to reflect that.

Signed-off-by: pkv <pkv@obsproject.com>
2023-06-24 17:11:01 -07:00
pkvandJim dfac68b189 obs-outputs: Log encoder incompatible with dynamic bitrate
This logs that dynamic bitrate is disabled when a codec which does not
support bitrate reconfiguration is used, such as aom, svt-av1 ...

Signed-off-by: pkv <pkv@obsproject.com>
2023-04-15 16:33:33 -07:00
pkvandJim 5d287734a8 UI: Switch RecFormat to RecFormat2
Commit f1223ca566
(UI: Set fragmented MP4/MOV as default for beta/rc)
changed RecFormat to RecFormat2.
This conflicts with the use of RecFormat introduced in
d18b38e784
(UI: Enable multiple audio tracks in Simple Output recording).
This fixes the issue.
An unused var is also removed.

Signed-off-by: pkv <pkv@obsproject.com>
2023-03-25 23:45:47 -07:00
pkvandRyan Foster d57d09e229 UI: Move tracks in Advanced Standard Recording
Per request of our UI design chief, the tracks from Standard Recording
(Advanced Output) are moved below the audio encoder field.
Additionally, for consistency with Simple output, the video encoder
field is moved above the audio encoder (suggestion from Rodney).

Signed-off-by: pkv <pkv@obsproject.com>
2023-03-25 20:54:07 -04:00
pkvandRyan Foster d18b38e784 UI: Enable multiple audio tracks in Simple Output recording
This adds support for multiple audio tracks in Simple Output for
recordings.
This is enabled for all quality presets (including "Lossless") except
"Same as Stream".
This is also enabled for the Replay Buffer.
An exception is made for flv recording format since it only allows a
single audio track.
The recorded track (and streaming track) is then Track 1 as before.

Signed-off-by: pkv <pkv@obsproject.com>
2023-03-25 20:54:07 -04:00
pkvandJim a0a23e8a18 libobs: Fix leak with empty path in stats
If the recording path is left empty in Settings, a leak can occur in
window-basic-stats.cpp because a bmalloc is called for a size 1.
This fixes the leak by checking against the path in the
os_get_free_disk_space function.

Signed-off-by: pkv <pkv@obsproject.com>
2023-03-04 16:23:07 -08:00
pkvandRyan Foster 2e79d4c902 obs-ffmpeg: Fix for FFmpeg 6 deprecating a flag
Also modifies libobs & deps/media-playback.
AV_CODEC_CAP_TRUNCATED was removed in avcodec 60 [1].
We ifdef the code depending on it to allow compilation.

[1] avcodec: remove FF_API_FLAG_TRUNCATED
https://github.com/FFmpeg/FFmpeg/commit/3ceffe783965767e62d59e8e68ecd265c98460ec

Signed-off-by: pkv <pkv@obsproject.com>
2023-03-01 13:23:51 -05:00
pkvandRyan Foster e355a32066 obs-ffmpeg: Relax 'lookahead' constraint when bitrate is updated
When bitrate is updated, a check against 'lookahead' setting is done.
If 'lookahead' is enabled, the bitrate update is disabled.
We indeed used to observe crashes with nvenc when frequent bitrate
resettings were effected while lookahead option was enabled.
But recent tests have shown that the issue is gone.
As a result this commit allows 'lookahead' with bitrate live update.

Signed-off-by: pkv <pkv@obsproject.com>
2023-02-17 15:41:43 -05:00
pkvandJim ad3df88fe3 obs-ffmpeg: Fix encoding of 2.1 with FFmpeg aac encoder
The aac spec has a list of default channel layouts that are implemented
by all aac encoders / decoders.
Unfortunately 2.1 is not in that list. When I wrote the surround sound
support into OBS, as a workaround I decided to encode 2.1 as
AV_CH_LAYOUT_SURROUND = FL+FR+FC.
The LFE channel is encoded as a regular audio channel which uses more
bits but this allows compatibility with all aac decoders.
Recently we updated to the new channel layout API of FFmpeg, but the
mapping of 2.1 to AV_CH_LAYOUT_SURROUND was forgotten in the FFmpeg
native aac encoder. This is remedied here.

Signed-off-by: pkv <pkv@obsproject.com>
2023-02-11 15:06:47 -08:00
pkvandJim 10e6d0fbd0 obs-filters: Improve upward compressor with soft knee
This adds a knee setting to the upward compressor.

Signed-off-by: pkv <pkv@obsproject.com>
2023-01-26 23:23:45 -08:00
pkvandJim f625bb579f obs-filters: Fix expander and upward compressor above threshold
Fixes behaviours above threshold for expander and upward compressor.
Fixes issues #8052 & #8030 .

Signed-off-by: pkv <pkv@obsproject.com>
2023-01-26 23:23:45 -08:00
pkvandJim ace518804b obs-filters: disable NVIDIA FX audio model loading when SDK is not installed
This fixes a bug reported by R1ch internally.
If someone uses NVIDIA noise suppression filter and later uninstalls
the SDK, there can be a crash because the filter tries to load the
models.

Signed-off-by: pkv <pkv@obsproject.com>
2023-01-10 13:32:29 -08:00
pkvandRyan Foster 85b714706c obs-filters: Log NVIDIA Effects version only if lib is found
Put the version logging behind a condition of having found a library.

Signed-off-by: pkv <pkv@obsproject.com>
2023-01-03 16:51:39 -05:00
pkvandJim c15cd23fcb obs-filter: Fix upward compressor
This fixes a bug where the upward compressor would hard limit above the
threshold.
Also this changes detection to RMS instead of peak for the upward
compressor.
This sounds better than peak (tested on regular mike and a test tone).

Signed-off-by: pkv <pkv@obsproject.com>
2022-12-09 12:12:55 -08:00
pkvandJim ece4d1e90e obs-ffmpeg: Allow srt stream to disconnect after timeout
Fixes #7848
Currently OBS_OUTPUT_INVALID_STREAM is emitted when a wrong password is
used. This commit expands the signal emission to case of timeouts.

Signed-off-by: pkv <pkv@obsproject.com>
2022-12-03 15:02:03 -08:00
pkvandRyan Foster 88ac8098a1 rtmp-services: Add ffmpeg-mpegts-muxer in schema v4
This adds ffmpeg-mpegts-muxer to the enum of output modules in schema.
Updates schema to v4.

Signed-off-by: pkv <pkv@obsproject.com>
2022-11-17 21:56:38 -05:00
pkvandRyan Foster fcb6df1f63 obs-ffmpeg: Direct setting of encryption & auth for SRT & RIST
Also modifies UI.

This allows the direct use of passphrase (SRT & RIST) used for
encryption, user + password (RIST) as well as streamid (SRT).
Previously, these parameters had to be set in the URL in the form:
URL?option1=value1&option2=value2.
They still can but there is also the option to set them in the stream
key and username/password fields.
SRT:
- the stream_id is set in the stream key (more info on it: [1]);
- the encryption passphrase is set in the password auth field.
RIST:
- the encryption passphrase is set in the stream key;
- the srp_username and srp_password are set in the user/password auth
fields [2].

Additionally, some error logging has been added when there's a
disconnect caused by a wrong password.
Lastly, this solves a bug when auto-reconnect is set and a wrong
passphrase is provided for srt; the output would keep trying to
reconnect. With this commit, an OBS_OUTPUT_INVALID_STREAM signal is
emitted and the stream is immediately stopped.

[1] https://github.com/Haivision/srt/blob/master/docs/features/access-control.md
[2] https://code.videolan.org/rist/librist/-/wikis/Authentication-and-the-ristsrppasswd-Utility

Signed-off-by: pkv <pkv@obsproject.com>
2022-11-17 21:56:38 -05:00
pkv f7086f2ec0 obs-filters: NVIDIA Background Removal variable mask refresh
This adds a slider to set variable mask refresh rate.
This is useful to alleviate the GPU load so that the mask generation
can optionally be done every n frames (n = 1-4).

Signed-off-by: pkv <pkv@obsproject.com>
2022-11-11 23:06:01 +01:00
pkv bed0175326 obs-filters: Add temporal processing to Background Removal
The AI detection is improved by enabling temporal processing for the
NVIDIA Background Removal filter.
This requires NVIDIA Video Effects version >= 7.1.0.
Fixes issue #7639 (VRR issue with previous sdk versions).

Signed-off-by: pkv <pkv@obsproject.com>
2022-11-11 23:06:01 +01:00
pkv 310a882dd8 obs-filters: Warn if NVIDIA Audio FX is outdated
This warns the user if the SDK version is outdated and suggests to
upgrade through a warning in the Properties window of the
filter.
Also removed the label RTX from the logs, just keeping NVIDIA Audio.

Signed-off-by: pkv <pkv@obsproject.com>
2022-11-11 23:06:01 +01:00
pkv c30868f056 obs-filters: Warn if NVIDIA Video FX is oudated
This checks if the redistributable for NVIDIA Video FX is the latest.
If it is not, a warning is displayed in the Property window for the
filter.
Also removed the label RTX from the logs, just keeping NVIDIA Video FX.
The NVIDIA Video FX loader has been updated to sdk 7.1.0.
The new functions of the sdk are not loaded though.

Signed-off-by: pkv <pkv@obsproject.com>
2022-11-11 23:05:53 +01:00
pkvandRyan Foster ce2d1ffab7 obs-ffmpeg: Fix deprecation of channels member of several structs
This fixes deprecation warnings since the channels member of
AVCodecContext is marked as deprecated [1], as well as the channels
member of AVFrame [2].
In all instances where a warning appear, a switch to the new API is
done.
[1] lavc: switch to the new channel layout API
FFmpeg/FFmpeg@548aeb9
[2] Bump minor versions after the channel layout changes
FFmpeg/FFmpeg@cdba98bb80

Signed-off-by: pkv <pkv@obsproject.com>
2022-11-10 19:37:07 -05:00
pkv2andRyan Foster 252e352a51 libobs: Change audio resampler to new channel API
The channel_layout API was overhauled by FFmpeg [1-5]. The previous
bitmask channel_layout is replaced by a struct ch_layout which combines
the number of channels, a bitmask and other infos.
The resampler needs to be updated whenever using swresample > 4.5.100.
This commit makes the necessary changes.

[1] Bump minor versions after the channel layout changes
FFmpeg/FFmpeg@cdba98b
[2] lavc: switch to the new channel layout API
FFmpeg/FFmpeg@548aeb9
[3] avutil/channel_layout: Add a new channel layout API
FFmpeg/FFmpeg@086a804
[4] avframe: switch to the new channel layout API db6efa18
FFmpeg/FFmpeg@db6efa1
[5] swresample: convert to new channel layout API
FFmpeg/FFmpeg@8a5896e

Signed-off-by: pkv <pkv@obsproject.com>
2022-11-10 19:37:07 -05:00
pkvandRyan Foster ce63c5b057 obs-ffmpeg: Update mpegts to channel API change
The channel_layout API was overhauled by FFmpeg [1-4]. The previous
bitmask channel_layout is replaced by a struct ch_layout which combines
the number of channels, a bitmask and other infos. This struct must now
be supplied to AVframes since avutil >= 57.24.100 and to
AVCodecContext since avcodec 59.24.100 per (1].
This commit provides the required info to obs-ffmpeg-mpegts.

[1] Bump minor versions after the channel layout changes
FFmpeg/FFmpeg@cdba98b
[2] lavc: switch to the new channel layout API
FFmpeg/FFmpeg@548aeb9
[3] avutil/channel_layout: Add a new channel layout API
FFmpeg/FFmpeg@086a804
[4] avframe: switch to the new channel layout API db6efa18
FFmpeg/FFmpeg@db6efa1

Signed-off-by: pkv <pkv@obsproject.com>
2022-11-10 19:37:07 -05:00
pkvandJim 8d457718dc obs-filters: Add upward compressor filter
An upward compressor increases levels below a threshold, instead of
decreasing levels above it. This is closely related to an expander; the
upward compressor can be seen as an expander with ratio in the [0,1]
range. This can be used for example when the game audio is lowered
against a voice track but that one still wants to be able to hear very
low game sounds.

For more use cases:
https://www.izotope.com/en/learn/4-tips-for-using-upwards-compression-in-neutron.html

Signed-off-by: pkv <pkv@obsproject.com>
2022-10-27 00:44:59 -07:00
pkvandJim dba3401ceb obs-filter: Update model for NVIDIA Audio FX
This updates the model when swapping effects with NVIDIA Audio Effects.
This fixes a bug where the model was not updated. :(

Signed-off-by: pkv <pkv@obsproject.com>
2022-09-22 06:47:23 -07:00