Commit graph

823 commits

Author SHA1 Message Date
derrod b34fbb116e obs-ffmpeg: Check if current NVENC configuration supports 4:4:4 encode 2024-06-26 13:57:43 -04:00
tt2468 6c389271b3 obs-ffmpeg: Close VAAPI device on vaInitialize fail
On some systems (eg. mine), VAAPI fails on vaInitialize. Valgrind was
able to spot that the device was not being closed, and it appears to
have been correct. This fixes a memory leak.
2024-06-19 19:46:05 -07:00
derrod 86502764b9 obs-ffmpeg: Set encoder error message for CUDA errors 2024-06-10 17:08:57 -04:00
Translation Updater 8999d9fef9 Update translations from Crowdin 2024-06-07 09:47:58 +00:00
Kurt Kartaltepe fc1ab5fcbc obs-ffmpeg: Check correct VA-API codec support
Previously, we just checked for H264 regardless of which codec was
selected. This mostly worked, but on Fedora they ship AV1 without H264
or HEVC. In that case users wont see AV1 as an option.
2024-06-01 19:14:46 -04:00
pkv 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] 3ae98511d0

Signed-off-by: pkv <pkv@obsproject.com>
2024-05-09 10:27:20 -04:00
Kurt Kartaltepe 01b61fafbf obs-ffmpeg: Release encode texture early
During high graphics thread pressure it can take a significant time to
acquire the graphics lock. This change releases the OpenGL texture after
rendering to avoid the 2nd lock after sending the frame to FFmpeg. This
improves 99%-tile/100%-tile and median encode in a near encoder overload
scenario, and modestly raises the ceiling before encoder overload in my
test scene.

Master:
min=0 ms, median=4.29 ms, max=33.072 ms, 99th percentile=8.877 ms
min=0 ms, median=4.438 ms, max=77.157 ms, 99th percentile=9.853 ms
min=0 ms, median=4.527 ms, max=57.292 ms, 99th percentile=9.282 ms

This commit:
min=0.97 ms, median=3.009 ms, max=13.215 ms, 99th percentile=5.899 ms
min=1.181 ms, median=2.91 ms, max=9.854 ms, 99th percentile=5.56 ms
min=0.461 ms, median=3.013 ms, max=10.693 ms, 99th percentile=5.871 ms
2024-05-02 18:15:01 -04:00
derrod 14f588f318 obs-ffmpeg: Fix output path logging 2024-04-24 16:03:14 -04:00
derrod 8d2f4ed3e1 obs-ffmpeg-mux: Use new process args/pipe API 2024-04-20 18:30:46 -07:00
David Rosca 06e364b670 obs-ffmpeg: Implement texture encoding for VAAPI 2024-04-20 17:03:54 -07:00
tytan652 02ead5b096 obs-ffmpeg: Fix unused variable in native NVENC 2024-04-16 11:15:22 -04:00
PatTheMav 34f8abae1f plugins: Update Linux slice of cross-platform plugins for CMake 3.0
Also silences acknowledged compile warnings introduced by the updated
compiler settings in the CMake update.
2024-04-13 23:48:38 -04:00
PatTheMav 2bc4c69ee9 plugins: Fix compile errors introduced by CMake build framework 3.0 2024-04-13 23:48:38 -04:00
tt2468 8b6924b80f plugins: Set keyframe flag on encoded audio packets
Not strictly necessary, and does not fix any bug. This just corrects a
nitpick that technically audio encoder packets are start points, but
that they aren't being labeled accordingly as keyframes.
2024-04-13 17:04:48 -07:00
Alex Luccisano c0f71f002c obs-ffmpeg: Use video_output_info in amf_create_encoder()
The frame rate used to initialize an AMF encoder should be aligned
with the derived frame rate in video_output_info instead of the global
obs_video_info structure. With this change, IDRs can be aligned when
multiple renditions are being encoded.

Using video_output_info members for the format, colorspace, and range
parameters in addition to the frame rate provides a single source for
this information and obs_video_info is no longer needed.
2024-04-13 17:00:26 -07:00
tt2468 3d30a4efea obs-ffmpeg: Remove mpegts format override for SRT and RIST
FFmpeg is already very effective at detecting the correct input format
for socket-style protocols (SRT, RIST, TCP, UDP, etc.). By overriding
the format of SRT and RIST manually to mpegts, the user is being
prevented from using other container formats via these protocols.

In the rare case that libavformat is unable to detect the correct
container format for an SRT or RIST stream, the user may manually
specify that format in the existing format field.

With the FFmpeg options field which was recently added, probe options
may be specified by the user to further tune format detection.
2024-04-10 18:45:45 -04:00
tytan652 8dbad9ac29 obs-ffmpeg: Fix incompatible-pointer-types with FFmpeg 7 2024-04-06 16:59:52 -07:00
derrod 3a1035576e obs-ffmpeg: Add Linux NVENC texture encoder 2024-03-31 02:33:07 -07:00
derrod 2f55f046fe obs-ffmpeg: Add native non-texture NVENC implementation 2024-03-31 02:05:40 -07:00
Ryan Foster 6f3f7b4e5a obs-ffmpeg: Fix NVENC compatibility hack for old drivers/hardware
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.
2024-03-27 19:11:26 -04:00
Ryan Foster 24470b351a obs-ffmpeg: Set needs_compat_ver before struct version checks
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.
2024-03-27 19:11:26 -04:00
derrod 5f2bb795f0 obs-ffmpeg: Fix HDR metadata not being written when using FFmpeg 6.1+ 2024-03-14 17:12:20 -04:00
Translation Updater 10b02e11d0 Update translations from Crowdin 2024-03-12 18:11:06 +00:00
PatTheMav f4733ec6a2 Update source code formatting with clang-format 17.0.3
Added SCDisplayRef type alias to fix a quirk of this specific
clang-format version with ObjC block syntax.
2024-03-11 15:55:30 -04:00
Vainock 7ae66c72fd Update translations from Crowdin 2024-02-28 14:20:05 -05:00
Kurt Kartaltepe 288ed51269 obs-ffmpeg: Receive packets while frame queue is full
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.
2024-02-10 17:25:14 -06:00
Evgeny Pavlov b79ba49252
obs-ffmpeg: Fix wrong framerate in AMF VUI header
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).
2024-02-03 17:31:00 -06:00
Translation Updater ac484a066f Update translations from Crowdin 2024-01-29 20:47:38 +00:00
bin b8155cdff7 obs-ffmpeg: Set audio stream title for FFmpeg record output 2024-01-26 22:28:36 -05:00
Ryan Foster c25f0592ae obs-ffmpeg: Use 2 tile columns in NVENC AV1 for 4K+
When resolution is 4K or higher, use 2 tile columns for NVENC AV1.
2024-01-23 17:31:31 -05:00
David Rosca 5d0323ea0a obs-ffmpeg: Set better VA-API defaults
Use High profile for H264 and auto level with all codecs.
Remove setting default value for unused "rendermode" option.
2024-01-23 15:19:44 -05:00
David Rosca 2dbd47441f obs-ffmpeg: Add AV1 support for VA-API 2024-01-23 15:19:44 -05:00
Ryan Foster 4fbbae59e3 CI: Update deps to 2024-01-18 release
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
2024-01-22 15:31:09 -05:00
rhutsAMD ab0b0cb7e2 obs-ffmpeg: Default the number of B-frames to 3 2024-01-22 09:48:12 -05:00
rhutsAMD e657e62c29 obs-ffmpeg: Fix issue with B-frames introducing motion blur
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).
2024-01-22 09:48:12 -05:00
derrod f083d14143 obs-ffmpeg: Replace circlebuf with deque 2024-01-16 16:45:10 +01:00
Lain 1e09f5a543
Merge pull request #10039 from derrod/roi-libobs
libobs/plugins: Add region of interest (ROI) encoder feature
2024-01-13 18:30:31 -06:00
Ruwen Hahn 8fb32c37ee obs-ffmpeg: Add disable_scenecut option for NVENC
This is functionally the same as x264's `scenecut=0` option
2024-01-13 17:49:34 -06:00
Rodney 730ab5e6d1 obs-ffmpeg: Add ROI support to AMF 2024-01-11 13:36:35 +01:00
Rodney 5e9b2d6322 obs-ffmpeg: Add ROI support for native NVENC 2024-01-11 13:36:35 +01:00
Ryan Foster cc25a14173 obs-ffmpeg: Fix incorrect CMake list syntax 2024-01-08 19:49:04 -05:00
derrod 24e59d1621 obs-ffmpeg: Fix NVENC compat hack ternary being inverted 2024-01-07 02:29:00 +01:00
pkv 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
derrod 4a8e8bb1bd obs-ffmpeg: Only use NVENC compatibility hack if necessary 2024-01-06 18:38:43 -06:00
Rodney 051d227b51 obs-ffmpeg: Remove Windows 7 NVENC fallback 2024-01-06 17:20:26 -06:00
Rodney 3594017fac obs-ffmpeg: Remove Ubuntu 20.04 NVENC fallback
Effectively reverts dd26fe4f8a
2024-01-06 17:20:26 -06:00
PatTheMav eae5cc1e38 plugins: Update CMake formatting with manual format choices 2023-12-19 17:59:44 -05:00
PatTheMav 9ae47a7937 cmake: Update FFmpeg find package to use explicit version 2023-12-19 17:59:44 -05:00
Translation Updater f674d17168 Update translations from Crowdin 2023-12-05 22:04:31 +00:00
derrod 859321b767 obs-ffmpeg: Add missing header to CMakeLists 2023-12-02 17:48:12 -06:00