Add a COMPAT version of NV_ENC_INITIALIZE_PARAMS_VER, which changed
between SDK 12.0 and 12.1.
If using drivers older than the configured SDK/API requires, fall back
to the compatibility version of the API (11.1).
An example scenario would be encoding in H.264 on driver version 512.15.
SDK 12.1 requires driver version 531.61 on Windows. Currently, in this
scenario, OBS will fall back to the FFmpeg encoder path, which will do
its own driver check, which will fail on this driver version.
With this change, this scenario will instead leverage the existing
compatibility hack to fall back to the compatibility version of the API
without falling back to FFmpeg.
It should be noted that while neat, the compatibility hack that enables
Kepler GPUs to continue to be able to use NVENC in this way is expected
to be removed at some point.
Because 4a8e8bb1bd changed the
NVENCAPI_STRUCT_VERSION define to rely on enc->needs_compat_ver, we must
do the conditional check and define needs_compat_ver before any structs
are initialized because they will check the version when doing so by
calling NVENCAPI_STRUCT_VERSION internally.
In this case, make sure that we define enc->needs_compat_ver before
NV_ENCODE_API_FUNCTION_LIST_VER is called for
NV_ENCODE_API_FUNCTION_LIST.
Previously, we always assumed we could push more frames before an encoded
packet would be available. Actually, we can get EAGAIN when the
frame queue is full and before any encoded packets have been completed.
Instead, attempt to read packets more often as the worst that can
happen is we get EAGAIN again.
Frame rate should be defined before AMF encoder initialization,
because this information is used for setting vui_time_scale in SPS.
If frame rate isn't defined before initialization,
then AMF encoder set default frame rate into VUI header (30 fps).
To avoid a compiler error, this commit also bumps the configured NVENC
version to match the updated version in the deps package.
Notable changes:
* deps.ffmpeg: Update zlib to 1.3
* deps.ffmpeg: Update SVT-AV1 to 1.8.0
* deps.ffmpeg: Update aom to 3.8.0
* deps.ffmpeg: Update libsrt to 1.5.3
* deps.ffmpeg: Update nv-codec-headers to 12.1.14.0
* deps.ffmpeg: Update AMF to 1.4.32
* deps.ffmpeg: Update FFmpeg to 6.1
* deps.macos: Update LuaJIT to 2.1 c525bcb902
* deps.macos: Update FreeType to 2.13.2
* deps.macos: Update Asio to 1.29.0
* deps.macos: Update nlohmann JSON to 3.11.3
* deps.macos: Update Sparkle to 2.5.2
* deps.macos: Update Syphon Framework to 5.0 39e31383ff
* deps.windows: Update FreeType to 2.13.2
* deps.windows: Update curl to 8.5.0
* deps.windows: Update LuaJIT to 2.1 c525bcb902
* deps.windows: Update Asio to 1.29.0
* deps.windows: Update nlohmann JSON to 3.11.3
* deps.windows: Update VPL to v2.10.1
* deps.qt: Update Qt6 to 6.6.1 for Windows
* deps.qt: Update Qt6 to 6.6.1 for macOS
If a user sets both AdaptiveMiniGOP=true and EnablePreAnalysis=true
in the AMF/FFmpeg options field, AMF will adaptively insert
B-pictures, and no longer uses the fixed B pattern.
For a fixed B-frames pattern, it is expected that increasing B-frames
can cause a quality drop for certain content such as with high motion.
AdaptiveMiniGOP is recommended when using B-frames to improve the
quality in such cases. AdaptiveMiniGOP is dependent on PreAnalysis
which means that trying to enable it without having PreAnalysis turned
ON will have no negative effect (AdaptiveMiniGOP won't be enabled).
Fixes for using FFmpeg 6.1 due to deprecations. Uses `#if` macros to
allow builds for using older versions of FFmpeg.
This commit replaces usage of `av_stream_add_side_data(...)` with
`av_packet_side_data_add(...)`, as the former was deprecated in favor of
the latter.
The FFmpeg commit that deprecated `av_stream_add_side_data(...)` is [1].
The FFmpeg commit that introduced `av_packet_side_data_add(...)` is [2].
Note that the deprecation commit is after the new API function. The
commit in between [3] appears to be changes that migrates to the usage
of the new API function.
[1]: avformat/avformat: use the side data from AVStream.codecpar
5432d2aaca
[2]: avcodec/packet: add generic side data helpers
74279227dd
[3]: avcodec/codec_par: add side data to AVCodecParameters
21d7cc6fa9
If an output has already stopped, but its StopRecording function was
called again, then ffmpeg_mux_stop would be called and set stopping to
true. On the next output start, OBS would output 1 frame, see that
stopping is true, and then stop the output.
This was most easily observed using an Output Timer to record prior to
93f5b45be8.
Initialize stopping to false with the other state flags to ensure that
the output has a clean starting state.
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] fb57eff212
Co-authored-by: tt2468 <tt2468@gmail.com>
Signed-off-by: pkv <pkv@obsproject.com>
(This commit also modifies obs-ffmpeg)
This change was meant for track matte stingers to prevent the last frame
from having risk of flashing due to their transparent nature, but this
code had a negative side effect on normal stingers as well.
Fixesobsproject/obs-studio#8981
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>