Commit Graph

846 Commits

Author SHA1 Message Date
Translation Updater
0b2c85845e Update translations from Crowdin 2024-12-06 23:21:55 +00:00
tytan652
dfc3a69c52 obs-ffmpeg: Avoid setting negative bitrate for lossless audio codec
Since FFmpeg 7.1 a check was added to disallow pre-initializing encoder
with a negative bitrate.

74385dd496
2024-11-20 13:27:38 -05:00
Exeldro
9e7b51a585 obs-ffmpeg: Fix deadlock on shutting down muxer 2024-10-07 15:16:42 -04:00
Translation Updater
e6d9f73736 Update translations from Crowdin 2024-10-05 05:02:27 +00:00
Ryan Foster
a1fbf1015f clang-format: Increase column limit from 80 to 120 2024-10-04 18:19:27 -04:00
tytan652
42670ab4e3 plugins/test: Remove legacy CMake remnants
Some legacy files were missed in 72428ccd97
2024-10-03 17:32:08 -04:00
PatTheMav
6c590805e8 cmake: Update supported CMake version range to 3.28 and 3.30 2024-09-13 14:42:32 -04:00
Exeldro
7a35d7c549 obs-ffmpeg: Add logging of audio track 2024-09-12 18:07:19 -04:00
tytan652
31385006d5 Remove legacy_check CMake macro
The macro was not removed in 72428ccd97
waiting for submodules to be be updated to a commit where their legacy
code path is removed.
2024-09-11 13:24:39 -04:00
tytan652
72428ccd97 Remove CMake legacy code path
Except submodules and legacy_check macro since the former depend on it.
2024-08-28 13:53:25 -04:00
Norihiro Kamae
15038232c5 obs-ffmpeg: Remove unexisting class name declaration
The class `Logger` was declared but it is never defined nor used.
2024-08-24 16:12:12 -07:00
derrod
baa1e1dc35 obs-ffmpeg: Remove compatibility with FFmpeg < 6.1 2024-08-23 13:44:04 -04:00
Lluís Batlle i Rossell
7c85253667 obs-ffmpeg: Fix VAAPI/NVENC ifdefs
VAAPI init was under NVENC clauses, so it was disabled if no NVENC.

That was introduced in af555b9372
from #10536, which refactored NVENC.
2024-08-16 13:25:07 -04:00
PatTheMav
b8cfacaec3 Update formatting of CMake files 2024-08-14 12:07:47 -04:00
pkv
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
derrod
af555b9372 obs-ffmpeg: Remove native/disable FFmpeg NVENC 2024-08-08 22:52:40 +02:00
Norihiro Kamae
e9c440401c obs-ffmpeg: Resolve unused-function warnings 2024-08-07 17:27:49 -04:00
Ruwen Hahn
b2d83efcf3 obs-ffmpeg: Disable AMF DTS adjustment for AV1 2024-07-30 11:10:47 -04:00
Ruwen Hahn
e7bf19d139 obs-ffmpeg: Disable NVENC DTS adjustment for AV1 2024-07-30 11:10:47 -04:00
tytan652
2a53015ad7 deps,shared,plugins: Move opts-parser to shared folder 2024-07-27 07:38:36 +02:00
tytan652
ade04f4f1c deps,shared,obs-ffmpeg: Move media-playback to shared folder 2024-07-27 07:38:36 +02:00
Translation Updater
e7d6707fa7 Update translations from Crowdin 2024-07-17 09:34:12 +00:00
derrod
c6a100a980 obs-ffmpeg: Honor preferred format in native NVENC 2024-07-06 16:18:52 -07:00
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