Want to avoid receiver gamut remapping from Rec. 2100 to P3.
Fix min luminance appearing as NaN by switching from 0/0 to 0/1.
Also set max luminance for HLG because why not.
stdout on Windows from a subprocess requires that something read the
stdout buffer, and currently we don't do that. Due to newly introduced
printf/fprintf calls, the stdout buffer eventually fills up because
nothing is emptying it, thus the muxer locks up on an fprintf/printf
call and causes OBS itself to hang.
Rec. 2020 is really an SDR spec, but I think HDR10 made it okay to slap
PQ on it, call it an HDR spec. Rec. 2100 came along after and formally
allowed the use of PQ/HLG, so we should use 2100 instead.
This is very much like previous commit, but there's a catch: there
already was an enumeration in place, which is replaced in this
commit. The obs_pw_capture_type enum was introduced before splitting
the portal code into a separate file, and the enum itself is specific
to the screencast portal, so the appropriate place to enumerate it
is in portal.h.
For completude, PORTAL_CAPTURE_TYPE_VIRTUAL was added to the enum,
even though we never used, and probably never will.
The values are still the same, since both the old and this new enum
were extracted from the screencast portal [1].
https://github.com/flatpak/xdg-desktop-portal/blob/main/data/org.freedesktop.portal.ScreenCast.xml#L290-300
The ScreenCast portal defines 3 cursor modes [1]:
* Hidden: no visible cursor (value: 1)
* Embedded: cursor is drawn in the frames (value: 2)
* Metadata: cursor is sent as stream metadata (value: 4)
The values are power-of-two due to be used as flags.
Explicitly listing these values in an enum improves legibility
of the code, so do that instead of hardcoding 1, 2, and 4.
[1] https://github.com/flatpak/xdg-desktop-portal/blob/main/data/org.freedesktop.portal.ScreenCast.xml#L302-L316
The portal.c file was introduced after the PipeWire code landed, and
handles acquiring a D-Bus connection to the portal interface, and also
has helpers to get properties from portals. The available cursor modes
property fits nicely in portal.c.
Move fetching the cursor mode to portal.c.
Ellipses in log messages bring a tone of vagueness and insecurity
that does not match the geist of the OBS Studio community. We're
a bold, industry-leading community producing software that is at
the heart of the biggest services of today's world. When it comes
to PipeWire and Wayland adoption, we're quite literally the app
that protocols and portals are designed for.
Therefore, it is unacceptable that the log messages in the PipeWire
capture don't communicate how strong of a community we are. Not
only that, these ellipses bring harm on the long run. After all,
who on their right mind would design protocols, portals, and user
interactions for an app that doesn't even log their messages in
accordance to its community values?
Our logs must shout strength. They must reflect that OBS Studio
is here to stay. Readers of such logs must fasten their seatbelts
before opening these files. Competition tremble with dread and
fear when presented with these logs. Only extreme metal singers
should be able to read these logs out loud.
No compromise.
Remove ellipses from PipeWire log messages.
They are inconsistently capitalized, some with sentence capitalization,
some completely lower-cased.
Capitalize all log messages using sentence capitalization.
The information that we currently log is not enough to give proper
support, and at best allows us to know that the first few steps of
negotiation worked.
Transform a few key debug messages into infos.
Per upstream this function is not supposed to be called by users of
PipeWire, and will crash when called twice. Instead only call it on
recent versions of PipeWire where it is safe to call.
This also removes the nearly empty pipewire-common files.
The `add_target_resource` function uses unnecessary path components
when copying files to the rundir, resulting in files added that way
not to end up where OBS expects them to.
The generated binaries created by sub-targets also need to be copied
as part of `win-capture`'s data files, which was easy to fix as the
target exists before CMake switches into the subdirectories.
Status output related to OBS configuration is prefixed with the string
"OBS" and added padding for enabled and disabled features. This padding
was not aligned between platforms.
By moving the padding and prefix decoration into its own function,
both elements are controlled in a single place. CMake scripts were
changed to use this new function `obs_status` instead of using CMake's
`message` function directly.
sizeof(AVPacket) being a part of the public ABI is deprecated. once
av_init_packet() is removed, new packets will only be able to be
allocated with av_packet_alloc().
In ffmpeg-mux, ffmpeg-vaapi, and obs-ffmpeg-nvenc, AVPacket is allocated
at the initialization to avoid frequent allocation of AVPacket.
Includes changes to win-dshow.
In the years since this code was added, ALPN is now widely supported,
and NPN is being removed entirely in the latest version of nginx. It's
time to start using ALPN!
This sets the aac bitstream to ADTS for the mpegts output.
This fixes a bug with mpegts ouput where the avformat muxer issues
an error with fdk-aac encoder.
Signed-off-by: pkv <pkv@obsproject.com>
_dx9_simple_free already frees this pointer. I don't think this code
path is currently reachable, but it should probably still be fixed.
Detected by Coverity Scan.
Similar to the Windows counter part. Check the PCI bus for
installed cards. When found at least one VGA compatible adapter
from NVIDIA that is not in the blacklist we pass the check.
Apparently the testing that was done was not sufficient enough or did
not check all test cases, so resolution/fps does not get set properly on
the virtualcam.
This causes the thread to only start when the IMediaFilter::Run/Pause
calls have been made, and stop whenever either the IMediaFilter::Stop
call has been made, or on destruction, whichever comes first.
This potentially will work around a suspected race condition that
appears to be in the WebRTC library where the filter's library will be
released while the filter is in the process of being destroyed, which
can take longer than usual if the join takes too long. Basically, fixes
a reported crash (that doesn't appear to technically be our fault) when
the filter is used with browsers when the virtualcam is deactivating in
web browsers.
Sort video device entries with `alphasort` on non-Linux platforms,
as opposed to `versionsort` on Linux.
(`versionsort` is a GNU extension, unavailable on e.g. FreeBSD.)
UI: Fix call to `to_string` on FreeBSD
Update the in-tree nv-codec-header files (nvEncodeAPI.h and
dynlink_cuda.h) to n11.1.5.1, which is the version currently used in the
OBS Studio dependencies, to keep the in-tree version in sync with the
version in our dependencies.
Previously the switch did not catch all cases issuing a quite large
warning. Also there was a const-ness warning for codecs on ffmpeg 5.0
that this addresses.
This may have been the issue behind the reported firefox crashes, but
strangely, the thread should always be joinable here because it's
explicitly always created in the constructor and joined in the
destructor.
Our version fixes the system freeze issue, reduces resource usage, and
improves performance back to 3770 levels.
See obsproject/cef@36fdac16a7 for detailed information.
Previously we assumed mjpeg was always decoded to 422 but it seems some
cameras provide frames that decode to different pixel formats such as
420.
This change delays setting the obs frame pixel format until after we
have decoded the v4l2 frame.
fixes#5821
More accurate and cheaper.
This is a breaking change because Amount is also now computed as linear,
but most users are probably using 1.0, so v2 isn't worthwhile.
Intel UHD Graphics 750: 980 µs -> 860 µs
This fixes crashes in media Source when :
- the user forgets to set the input format for srt or rist URLs;
- disabling / enabling / disabling etc Media source with a rist URL.
Signed-off-by: pkv <pkv@obsproject.com>
Instead of holding onto an acquire over the duration of an entire frame,
acquire, copy to a texture, and immediately release the lock.
(Note from Jim: When it comes to synchronization, the idea of acquiring
a lock, and then releasing all the way in the next frame just feels a
bit worrisome. Especially when it's a GPU object. But at this point, I'm
just making shots in the dark in an attempt to eliminate any possible
things that might even have a remote chance to trigger latent bugs in a
GPU driver or the kernel. You know, that whole system freeze thing. This
probably doesn't have anything to do with it, at this point I have
nothing but wild geese to chase. Whatever.)
For SVT-AV1, rate control is explicitly set via an "rc" option, so set
those options manually for SVT-AV1. CBR doesn't seem to be fully
supported, but it's sort of supported via CVBR (constrained variable
bitrate), which seems to be specific to each GOP size, which is about as
close to CBR as we can get.
Commit a3a6710 introduced the obs_pipewire_save() function in the
PipeWire code, but only set it to the monitor capture source. This
was an oversight, it should have been set to the window capture
source as well.
Set the .save vfunc of the window capture source as well.
Closesobsproject/obs-studio#5906
On Windows, All Files was added by default with (*), but on macOS and
Linux this appeared as an empty option in the dropdown and treated as a
Video Files filter rather than All Files.
This also adds proper translation handling for 'Video Files', matching
the obs-ffmpeg-source.
Fixes#5870
The vlc plugin was keeping only up to two audio channels. It was overlooked when surround sound support was added to obs-studio. This commit remedies this oversight.
Signed-off-by: pkv <pkv@obsproject.com>
While the Apple documentation currently seems to indicate that we should
set RealTime to True, it appears that this may be causing issues with
the encoder not being able to meet the target frame rate. Both FFmpeg
and Handbrake have recently explicitly set this value to False, and
preliminary tests seem to indicate that setting this to false in OBS has
favorable results.
The encoder property kVTCompressionPropertyKey_ExpectedFrameRate is a
hint to the video encoder. Since frame rates can be fractional, let's
use a float here instead of an int.
OBS no longer supports building on OSX. The minimum version of macOS
that we support is macOS 10.13. We can safely remove this 10.8
compatibility code.
Crosspoint indices were wrong for the UHD4K_ST425_Quad_3Gb_Squares_RGB_Capture preset and VPID was not being set for the selected 3G-Level B transport mode.
The timeout_usec variable is uint64_t, but the log format was set to %ld
(signed long int), so it would sometimes log a nonsensical value. Let's
use $PRIu64 instead, which should be equivalent to %llu (unsigned long
long int).
Fixes#5797.
avcodec.h stopped including channel_layout.h per FFmpeg commit
1be3d8a0cb77 [1]. Fixes compilation error on macOS against
FFmpeg later than the mentioned commit.
[1] 1be3d8a0cb
NVIDIA drivers appears to have a bug where binding would be excessively
slow. Apply a workaround similar to what [KWin] does to prevent the issue.
Also performs a refactor so that the code paths with and without the
workaround can be shared.
[KWin]: 4f2c3a00c4/src/libkwineffects/kwinglplatform.cpp
Fixes: 316f858c6 ("linux-capture: Fix capturing on software rasterization setups")
Closes: https://github.com/obsproject/obs-studio/issues/5685
Tested-By: univrsal <uni@vrsal.xyz>
We've been listing the supported formats in place whenever we
needed so far, but now we're doing it in too many different
places, which is getting confusing.
Move all these sparsely written rules into one single table
of formats, and adjust the code to lookup data on it.
Choice pods are built with the first element being the
preferred choice, followed by a list of possible choices.
We add the preferred choice inside the loop, which makes
the code slightly harder to follow.
Factor this out of the loop, into a separate step.
From Windows 7 onwards, dynamic send buffering is enabled. By setting
SO_SNDBUF explicitly, we actually disabled the dynamic send buffering
feature which results in reduced throughput. Thankfully this did not
affect the majority of users since the default send buffer is usually
already 64k.
This commit replaces the setting of SO_SNDBUF with log output showing
the current value of SO_SNDBUF at stream start and end. This will aid in
debugging throughput issues caused by a buffer that isn't big enough,
perhaps as a result of the user disabling dynamic send buffering
system-wide.
If B-frame is enabled in video encoder, video packets have different PTS
and DTS, however audio packets do not. That caused audio packets at the
splitting point goes to a different file and audio glitch appeared in an
NLE.
This commit adds a setting to reset timestamps when splitting files.
Some NLEs cannot handle video files whose starting timestamp is not
zero. Default is enabed.
This commit adds 3 new properties to split output file in the output
`ffmpeg_muxer`.
- `max_time_sec` specifies the limit in seconds.
- `max_size_mb` specifies the limit in megabytes.
- `allow_overwrite` specifies to test an existing file.
If both `max_time_sec` and `max_size_mb` are not positive, the split
file feature won't be enabled.
Another output ffmpeg_mpegts_muxer shares the code but is not affected
since the output is used only for streaming.
This commit fixes an issue that the last audio packet is sometimes not
written into mp4 format. Since libavformat internally calculates the
packet duration from the frame_size specified in the codec parameter, it
is necessary to set frame_size.