Commit Graph

671 Commits

Author SHA1 Message Date
Richard Stanway
668775f4f0 obs-ffmpeg: Use gai_strerrorA for error logging on Windows
Avoids wide characters in the format string which cause truncation.
2023-01-27 23:41:07 +01:00
tytan652
ee144377dc cmake,obs-ffmpeg: Refactor Libva finder
This refactor adds Libva DRM, required for obs-ffmpeg
2023-01-25 13:14:41 -05:00
jpark37
3462ea3fda obs-ffmpeg: Tell FFmpeg that BGRA uses alpha
Prevents alpha from getting dropped with custom encoders.
2023-01-24 18:39:12 -08:00
tytan652
c648222332 libobs,libobs-opengl,obs-ffmpeg-mux: Calm deprecation warnings on *nix
Calm libobs-opengl deprecation warnings on macOS.

Calm FFmpeg deprecation warning with LIBAVFORMAT_VERSION_MAJOR < 59.
2023-01-19 13:08:46 -05:00
tytan652
d473c9416f obs-ffmpeg: Fix compilation warnings on Clang and GCC
- Fix format warnings
- Fix unused-parameter warnings
2023-01-19 13:08:46 -05:00
tytan652
b0c1c9c86c libobs,plugins: Remove individual -Wno-switch 2023-01-19 13:08:46 -05:00
tytan652
cf5c68b773 UI,libobs,libobs-opengl,obs-ffmpeg: Remove unneeded cast in switches
Those casts were usually used to workaround switch warnings.

Also adds default to OBS frontend event switches that had this
workaround.
2023-01-16 11:52:26 +01:00
Chris (Flaeri)
1166e504bb obs-ffmpeg: Remove forced x264 and aac for RTMP
Remove code forcing x264 and ffmpeg aac encoder. People using custom
ffmpeg output should be able to use other video and audio encoders when
streaming with RTMP, given its h264 or aac.
2023-01-13 09:42:41 -08:00
Translation Updater
783bd52197 Update translations from Crowdin 2023-01-08 04:10:37 +00:00
jp9000
122e864c38 obs-ffmpeg, obs-qsv11: Ensure adapter order in encoder tests
On systems with multiple graphics adapters, one card can be configured
as power saving, and another card can be configured as performance.
Sometimes, OBS and the encoder test subprocesses will not be configured
the same way, so it's necessary to provide adapter order to the encoder
test subprocesses.

This change ensures the adapter order by passing the LUIDs to the test
subprocesses. The adapter indexes will then be updated accordingly.
2022-12-19 12:17:30 -08:00
jp9000
2396c4a01c obs-ffmpeg: Remove EnumOutputs from encoder tests
This call will fail on multi-adapter systems, and isn't used anyway, so
just remove it. Not sure why it was called in the first place; pretty
sure it was unintended and was likely just copied over from the D3D11
subsystem code.
2022-12-19 12:03:01 -08:00
jpark37
b7b7f0ae88 obs-ffmpeg: Set chroma location for VA-API 2022-12-11 14:12:36 -08:00
Jim
c84fae52e8 obs-ffmpeg: Fix AMF default CQP value
Was 7 for some reason, was supposed to be 20
2022-12-10 19:03:15 -08:00
Roman Huts
4ba6b8b6ee obs-ffmpeg: Add new rate control method mappings for AVC/HEVC 2022-12-09 15:37:09 -08:00
Jim
ddba05c36c obs-ffmpeg: Use enum for av1 encoders
Allows us to add rav1e later
2022-12-05 19:19:20 -08:00
Roman Huts
ad407eccab obs-ffmpeg: Bump AMF version to v1.4.29 2022-12-03 15:39:38 -08:00
Roman Huts
72a2c3baaa obs-ffmpeg: Add new rate control methods for AMD AVC/HEVC 2022-12-03 15:39:38 -08:00
jpark37
e8792ac791 obs-ffmpeg: Improve chroma location decision
The chroma location doesn't just depend on pixel format, but we're just
trying to pick something reasonable for now.
2022-12-03 15:24:18 -08:00
pkv
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
Chris
3d87b3b948 obs-ffmpeg: Disable VBAQ for H264 CQP rate control
Checks if rate control is CQP, if not, enable VBAQ. As per AMD, VBAQ
should not be used with CQP.
2022-11-30 17:42:59 -05:00
Chris
c4a8364b8c obs-ffmpeg: Disable VBAQ for HEVC CQP rate control
Check rate control, if cqp (0), dont use vbaq
2022-11-22 04:13:56 -08:00
Matt Gajownik
0716e8b482 obs-ffmpeg: Fix building without HEVC on Windows 2022-11-21 18:54:09 +11:00
tt2468
24d7bea41f obs-ffmpeg: Improve RIST/SRT log messages
Overall improvements to match behavior of other log sources.
2022-11-19 18:16:05 -08:00
Chris
a463326e37 ffmpeg: fix cqp rate control on svtav1
global_quality does not get respected. Specifying via priv_data does
work however
2022-11-19 20:55:42 -05:00
Chris
777a8f8c47 ffmpeg: fix "cqp" mode for libaom
change from global_quality to setting crf via priv_data, as
global_quality does not get respect. There is no cqp param in
ffmpeg 5.0.1
2022-11-19 20:55:42 -05:00
tytan652
74b245431c obs-ffmpeg: Use Libva in FFmpeg VA-API
Libva is directly used to check if DRI devices support H264 encoding.
2022-11-20 11:30:40 +11:00
Jim
572407a928 Merge pull request #7809 from obsproject/amf-av1-rebased
Add Hardware AMD AV1 Encoder
2022-11-19 15:52:16 -08:00
Ryan Foster
46e17a1160 obs-ffmpeg: Fix SVT-AV1 rate control mode selection
In updated versions of FFmpeg (5.1.x) and SVT-AV1 (1.2.0/1.3.0), the
rate contol mode selection mechanism has changed, causing CBR to throw
an "Invalid Parameter" error and the encoder will fail to start. This
appears to be caused by us specifying rc_max_rate, which will also fail
on FFmpeg CLI. Adjust how we manage rate control methods, appropriately
version-gated, to work with both our current dependency versions and the
versions that we'd like to use.
2022-11-19 15:44:12 -08:00
Roman Huts
341f288b57 obs-ffmpeg: Fix encoder preset quality fallbacks for AVC/HEVC/AV1
(Jim note: The missing description of this commit is that basically, the
CAP_MAX_THROUGHPUT value returns a different result based upon what the
other settings are currently set to. It didn't operate the way it was
originally programmed.)
2022-11-18 18:18:08 -08:00
Roman Huts
49e5f7783f obs-ffmpeg: Suggest docs to reference for AMF/FFmpeg options 2022-11-18 18:18:08 -08:00
Roman Huts
927733240c obs-ffmpeg: Add AMF AV1 encoder 2022-11-18 18:18:08 -08:00
Roman Huts
a8fc9226f8 obs-ffmpeg: Use codec enum for AMF texture encode check 2022-11-18 18:18:08 -08:00
Roman Huts
8b386a6417 obs-ffmpeg: Make AMF AVC encoder name consistent w/ others 2022-11-18 18:18:08 -08:00
Roman Huts
ef1a9c46e3 obs-ffmpeg: Only show b-frames AMF property for AVC 2022-11-18 18:18:08 -08:00
Roman Huts
1948ddf2fa obs-ffmpeg: Only allow AMF high/baseline profiles for AVC 2022-11-18 18:18:08 -08:00
Roman Huts
535ced04d5 obs-ffmpeg: Allow 0-51 for CQP property
0-51 makes it consistent with other encoder implementations (At least
for AVC/HEVC)
2022-11-18 18:18:08 -08:00
Roman Huts
21d079fdcc obs-ffmpeg: Use codec enum for amf_properties_internal 2022-11-18 18:18:08 -08:00
Roman Huts
acfad45ead obs-ffmpeg: Fix transcoding API typo 2022-11-18 18:18:08 -08:00
Roman Huts
48b5fd5a3b obs-ffmpeg: Update AMF SDK for AV1 support 2022-11-18 18:18:08 -08:00
Jim
8806738a04 obs-ffmpeg: Change default nvenc preset to P5
P6 seems to invoke lookahead, which causes lag for some older GPUs and
interferes with game performance. So let's just use P5 by default for
now. Shouldn't really affect recording anyway.
2022-11-18 12:38:54 -08:00
tytan652
c8a01f92ee obs-ffmpeg: Fix SRT error type comparison (#7802) 2022-11-18 03:17:54 -06:00
pkv
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
Jim
9116ceab6e obs-ffmpeg: Use compatibility options on nvnenc init fail
This fixes an issue where older nvidia video cards weren't able to
initialize nvenc due to not having (or having limited) multipass support
2022-11-17 10:55:06 -08:00
PatTheMav
d87467666b obs-ffmpeg: Replace invocations of sprintf with snprintf
Fixes deprecation warnings in Xcode 14/clang on macOS and reduces
chance of buffer overflows.
2022-11-11 19:51:28 +01:00
pkv
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
pkv
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
Developer-Ecosystem-Engineering
641ec29a00 obs-ffmpeg: Add codec-tag support to ffmpeg-mux
By default, ffmpeg-mux is guessing at the codec format of submitted data.
This change allows encoders to suggest a particular codec.
2022-11-02 22:44:20 +01:00
jp9000
929a68bdff Revert "obs-ffmpeg: Check nvenc max bframe count"
This reverts commit a793748743.

Not necessary, there's a better fix with 77fbfbe5c6.
2022-11-01 15:26:42 -07:00
Ryan Foster
77fbfbe5c6 obs-ffmpeg: Cap NVENC Max B-frames according to GPU caps
Erroring out of NVENC init early if the Max B-frames setting was higher
than the encoder's capability causes an encoder failure on NVIDIA Pascal
(10-series) and earlier GPUs due to an unfortunate interaction between
Simple Output Mode, HEVC, and our default B-frames setting of 2. Since
we already check the Max B-frames capability of the encoder, cap at that
value instead of erroring out.

Fixes #7698.
2022-11-01 15:26:23 -07:00
jp9000
a793748743 obs-ffmpeg: Check nvenc max bframe count
Checks to make sure that the bframe count is equal to or below the
maximum number of bframes that the encoder for the codec supports.

Fixes a bug where setting bframes higher than what the encoder supports
would cause the encoder to not start up properly.
2022-11-01 00:45:30 -07:00