update to 30.0.2

This commit is contained in:
Ward from fusion-voyager-3 2024-02-25 22:22:58 +03:00
parent b4a7036386
commit 854aa51470
21 changed files with 2183 additions and 3123 deletions

4
debian/changelog vendored
View File

@ -1,6 +1,6 @@
obs-studio (29.1.3-100pika3) pikauwu; urgency=low
obs-studio (30.0.2-100pika1) pikauwu; urgency=low
Update to 29.1.3
Update to 30.0.2
-- Kevin Henkel <obs.goldace@gmail.com> Sat, 04 Feb 2023 12:48:06 +0100

2
debian/rules vendored
View File

@ -8,4 +8,4 @@ AJA_DIR := $(BASE_DIR)/ntv2
dh $@
override_dh_auto_configure:
#dh_auto_configure -- -DOBS_VERSION_OVERRIDE="29.1.3" -DBUILD_FOR_PPA=ON -DTWITCH_CLIENTID='unla3~mb`xq9`1dhr?1lhhg`65mah0' -DTWITCH_HASH='2D4A98C454B4B0B6' -DRESTREAM_CLIENTID='ml6b16ec(n9?1#9g?m#>9f0,gnkojhhd;oh6' -DRESTREAM_HASH='2DE8E8C514397EE9' -DYOUTUBE_CLIENTID='153066229607$$;a7mw2ig756r?vc<f{`3tr3|i4gq167?$$lrpw,``jbnerwb{ibltals!fjo' -DYOUTUBE_CLIENTID_HASH='2DA97470255F7240' -DYOUTUBE_SECRET=';kV4NTXP5r>D`7bdLO^>gT8U' -DYOUTUBE_SECRET_HASH='F6215E72FC78C76F' -DENABLE_PIPEWIRE=ON -DENABLE_AJA=ON -DENABLE_NEW_MPEGTS_OUTPUT=ON -DCMAKE_PREFIX_PATH=$(AJA_DIR) -DCEF_ROOT_DIR=$(CEF_DIR) -DCMAKE_BUILD_TYPE=Release
dh_auto_configure -- -DOBS_VERSION_OVERRIDE="29.1.3" -DBUILD_FOR_PPA=ON -DTWITCH_CLIENTID='unla3~mb`xq9`1dhr?1lhhg`65mah0' -DTWITCH_HASH='2D4A98C454B4B0B6' -DRESTREAM_CLIENTID='ml6b16ec(n9?1#9g?m#>9f0,gnkojhhd;oh6' -DRESTREAM_HASH='2DE8E8C514397EE9' -DYOUTUBE_CLIENTID='153066229607$$;a7mw2ig756r?vc<f{`3tr3|i4gq167?$$lrpw,``jbnerwb{ibltals!fjo' -DYOUTUBE_CLIENTID_HASH='2DA97470255F7240' -DYOUTUBE_SECRET=';kV4NTXP5r>D`7bdLO^>gT8U' -DYOUTUBE_SECRET_HASH='F6215E72FC78C76F' -DENABLE_PIPEWIRE=ON -DENABLE_NEW_MPEGTS_OUTPUT=ON -DENABLE_AJA=OFF -DCEF_ROOT_DIR=$(CEF_DIR) -DCMAKE_BUILD_TYPE=Release
dh_auto_configure -- -DOBS_VERSION_OVERRIDE="30.0.2" -DBUILD_FOR_PPA=ON -DTWITCH_CLIENTID='unla3~mb`xq9`1dhr?1lhhg`65mah0' -DTWITCH_HASH='2D4A98C454B4B0B6' -DRESTREAM_CLIENTID='ml6b16ec(n9?1#9g?m#>9f0,gnkojhhd;oh6' -DRESTREAM_HASH='2DE8E8C514397EE9' -DYOUTUBE_CLIENTID='153066229607$$;a7mw2ig756r?vc<f{`3tr3|i4gq167?$$lrpw,``jbnerwb{ibltals!fjo' -DYOUTUBE_CLIENTID_HASH='2DA97470255F7240' -DYOUTUBE_SECRET=';kV4NTXP5r>D`7bdLO^>gT8U' -DYOUTUBE_SECRET_HASH='F6215E72FC78C76F' -DENABLE_PIPEWIRE=ON -DENABLE_NEW_MPEGTS_OUTPUT=ON -DENABLE_AJA=OFF -DCEF_ROOT_DIR=$(CEF_DIR) -DCMAKE_BUILD_TYPE=Release

View File

@ -2,7 +2,7 @@
set -e
# Clone Upstream
git clone --recursive https://github.com/obsproject/obs-studio.git -b 29.1.3
git clone --recursive https://github.com/obsproject/obs-studio.git -b 30.0.2
cp -rvf ./debian ./obs-studio/
cd ./obs-studio

View File

@ -0,0 +1,43 @@
From 0ccb3579b3e8a2f86ac29da9695b91374cfd96c4 Mon Sep 17 00:00:00 2001
From: Thomas Crider <gloriouseggroll@gmail.com>
Date: Fri, 22 Dec 2023 18:25:09 -0500
Subject: [PATCH] Revert "Disable browser panels on Wayland"
This reverts commit 7402271392a6a74fb49f16d84fb3c04c1b603d9a.
---
panel/browser-panel.hpp | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/panel/browser-panel.hpp b/panel/browser-panel.hpp
index dd61f38..5fb9d35 100644
--- a/panel/browser-panel.hpp
+++ b/panel/browser-panel.hpp
@@ -12,10 +12,6 @@
#include <dlfcn.h>
#endif
-#ifdef ENABLE_WAYLAND
-#include <obs-nix-platform.h>
-#endif
-
struct QCefCookieManager {
virtual ~QCefCookieManager() {}
@@ -81,14 +77,6 @@ struct QCef {
static inline void *get_browser_lib()
{
- // Disable panels on Wayland for now
- bool isWayland = false;
-#ifdef ENABLE_WAYLAND
- isWayland = obs_get_nix_platform() == OBS_NIX_PLATFORM_WAYLAND;
-#endif
- if (isWayland)
- return nullptr;
-
obs_module_t *browserModule = obs_get_module("obs-browser");
if (!browserModule)
--
2.43.0

View File

@ -0,0 +1,47 @@
From fcd09096796a259c8c438627528c92829be39c01 Mon Sep 17 00:00:00 2001
From: Thomas Crider <gloriouseggroll@gmail.com>
Date: Fri, 22 Dec 2023 19:10:34 -0500
Subject: [PATCH] Revert "UI: Avoid registering CEF OAuth integrations on
Wayland"
This reverts commit 169cd07c42ddf1d0693094badb75f6255c052fac.
---
UI/auth-restream.cpp | 5 -----
UI/auth-twitch.cpp | 5 -----
2 files changed, 10 deletions(-)
diff --git a/UI/auth-restream.cpp b/UI/auth-restream.cpp
index bedc10c70..cf8a3e098 100644
--- a/UI/auth-restream.cpp
+++ b/UI/auth-restream.cpp
@@ -282,11 +282,6 @@ static void DeleteCookies()
void RegisterRestreamAuth()
{
-#if !defined(__APPLE__) && !defined(_WIN32)
- if (QApplication::platformName().contains("wayland"))
- return;
-#endif
-
OAuth::RegisterOAuth(restreamDef, CreateRestreamAuth,
RestreamAuth::Login, DeleteCookies);
}
diff --git a/UI/auth-twitch.cpp b/UI/auth-twitch.cpp
index 88e14e0be..abc9cae66 100644
--- a/UI/auth-twitch.cpp
+++ b/UI/auth-twitch.cpp
@@ -512,11 +512,6 @@ static void DeleteCookies()
void RegisterTwitchAuth()
{
-#if !defined(__APPLE__) && !defined(_WIN32)
- if (QApplication::platformName().contains("wayland"))
- return;
-#endif
-
OAuth::RegisterOAuth(twitchDef, CreateTwitchAuth, TwitchAuth::Login,
DeleteCookies);
}
--
2.43.0

View File

@ -0,0 +1,104 @@
From 04d3a21c6e72cd5574f7333adf548012d912c1ee Mon Sep 17 00:00:00 2001
From: Neal Gompa <neal@gompa.dev>
Date: Sat, 7 Jan 2023 23:15:13 -0500
Subject: [PATCH 1/3] UI: Consistently reference the software H264 encoder
properly
The code here assumes that the only software encoder is the x264-based
H.264 encoder. That may not always remain true. This change adjusts
the encoder string to indicate that it's an H.264 encoder from x264.
---
UI/data/locale/en-US.ini | 4 ++--
UI/window-basic-auto-config-test.cpp | 6 +++---
UI/window-basic-settings-stream.cpp | 2 +-
UI/window-basic-settings.cpp | 7 ++++---
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/UI/data/locale/en-US.ini b/UI/data/locale/en-US.ini
index 4c03aa7db..e44d99660 100644
--- a/UI/data/locale/en-US.ini
+++ b/UI/data/locale/en-US.ini
@@ -980,7 +980,7 @@ Basic.Settings.Output.Simple.Warn.Encoder="Warning: Recording with a software en
Basic.Settings.Output.Simple.Warn.Lossless="Warning: Lossless quality generates tremendously large file sizes! Lossless quality can use upward of 7 gigabytes of disk space per minute at high resolutions and framerates. Lossless is not recommended for long recordings unless you have a very large amount of disk space available."
Basic.Settings.Output.Simple.Warn.Lossless.Msg="Are you sure you want to use lossless quality?"
Basic.Settings.Output.Simple.Warn.Lossless.Title="Lossless quality warning!"
-Basic.Settings.Output.Simple.Encoder.Software="Software (x264)"
+Basic.Settings.Output.Simple.Encoder.Software.X264.H264="Software (x264)"
Basic.Settings.Output.Simple.Encoder.Hardware.QSV.H264="Hardware (QSV, H.264)"
Basic.Settings.Output.Simple.Encoder.Hardware.QSV.AV1="Hardware (QSV, AV1)"
Basic.Settings.Output.Simple.Encoder.Hardware.AMD.H264="Hardware (AMD, H.264)"
@@ -991,7 +991,7 @@ Basic.Settings.Output.Simple.Encoder.Hardware.NVENC.AV1="Hardware (NVENC, AV1)"
Basic.Settings.Output.Simple.Encoder.Hardware.NVENC.HEVC="Hardware (NVENC, HEVC)"
Basic.Settings.Output.Simple.Encoder.Hardware.Apple.H264="Hardware (Apple, H.264)"
Basic.Settings.Output.Simple.Encoder.Hardware.Apple.HEVC="Hardware (Apple, HEVC)"
-Basic.Settings.Output.Simple.Encoder.SoftwareLowCPU="Software (x264 low CPU usage preset, increases file size)"
+Basic.Settings.Output.Simple.Encoder.SoftwareLowCPU.X264.H264="Software (x264 low CPU usage preset, increases file size)"
Basic.Settings.Output.Simple.Codec.AAC="AAC"
Basic.Settings.Output.Simple.Codec.AAC.Default="AAC (Default)"
Basic.Settings.Output.Simple.Codec.Opus="Opus"
diff --git a/UI/window-basic-auto-config-test.cpp b/UI/window-basic-auto-config-test.cpp
index 2d89d7347..09979c031 100644
--- a/UI/window-basic-auto-config-test.cpp
+++ b/UI/window-basic-auto-config-test.cpp
@@ -993,7 +993,7 @@ void AutoConfigTestPage::TestRecordingEncoderThread()
}
#define ENCODER_TEXT(x) "Basic.Settings.Output.Simple.Encoder." x
-#define ENCODER_SOFTWARE ENCODER_TEXT("Software")
+#define ENCODER_X264 ENCODER_TEXT("Software.X264.H264")
#define ENCODER_NVENC ENCODER_TEXT("Hardware.NVENC.H264")
#define ENCODER_QSV ENCODER_TEXT("Hardware.QSV.H264")
#define ENCODER_AMD ENCODER_TEXT("Hardware.AMD.H264")
@@ -1033,7 +1033,7 @@ void AutoConfigTestPage::FinalizeResults()
auto encName = [](AutoConfig::Encoder enc) -> QString {
switch (enc) {
case AutoConfig::Encoder::x264:
- return QTStr(ENCODER_SOFTWARE);
+ return QTStr(ENCODER_X264);
case AutoConfig::Encoder::NVENC:
return QTStr(ENCODER_NVENC);
case AutoConfig::Encoder::QSV:
@@ -1046,7 +1046,7 @@ void AutoConfigTestPage::FinalizeResults()
return QTStr(QUALITY_SAME);
}
- return QTStr(ENCODER_SOFTWARE);
+ return QTStr(ENCODER_X264);
};
auto newLabel = [this](const char *str) -> QLabel * {
diff --git a/UI/window-basic-settings-stream.cpp b/UI/window-basic-settings-stream.cpp
index f6e0817a0..b056938e7 100644
--- a/UI/window-basic-settings-stream.cpp
+++ b/UI/window-basic-settings-stream.cpp
@@ -1585,7 +1585,7 @@ void OBSBasicSettings::ResetEncoders(bool streamOnly)
#define ENCODER_STR(str) QTStr("Basic.Settings.Output.Simple.Encoder." str)
- ui->simpleOutStrEncoder->addItem(ENCODER_STR("Software"),
+ ui->simpleOutStrEncoder->addItem(ENCODER_STR("Software.X264.H264"),
QString(SIMPLE_ENCODER_X264));
if (service_supports_encoder(vcodecs, "obs_qsv11"))
ui->simpleOutStrEncoder->addItem(
diff --git a/UI/window-basic-settings.cpp b/UI/window-basic-settings.cpp
index fb170bfc1..48bb4bac6 100644
--- a/UI/window-basic-settings.cpp
+++ b/UI/window-basic-settings.cpp
@@ -5286,10 +5286,11 @@ void OBSBasicSettings::FillSimpleRecordingValues()
ADD_QUALITY("HQ");
ADD_QUALITY("Lossless");
- ui->simpleOutRecEncoder->addItem(ENCODER_STR("Software"),
+ ui->simpleOutRecEncoder->addItem(ENCODER_STR("Software.X264.H264"),
QString(SIMPLE_ENCODER_X264));
- ui->simpleOutRecEncoder->addItem(ENCODER_STR("SoftwareLowCPU"),
- QString(SIMPLE_ENCODER_X264_LOWCPU));
+ ui->simpleOutRecEncoder->addItem(
+ ENCODER_STR("SoftwareLowCPU.X264.H264"),
+ QString(SIMPLE_ENCODER_X264_LOWCPU));
if (EncoderAvailable("obs_qsv11"))
ui->simpleOutRecEncoder->addItem(
ENCODER_STR("Hardware.QSV.H264"),
--
2.39.2

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,346 @@
From 4517d8d8bb4c43af1f5b757773a5f9550bd23d37 Mon Sep 17 00:00:00 2001
From: Neal Gompa <neal@gompa.dev>
Date: Sun, 26 Mar 2023 06:06:31 -0400
Subject: [PATCH 2/3] obs-ffmpeg: Add initial support for the OpenH264 H.264
software codec
This allows users to leverage the OpenH264 codec from Cisco to encode
H.264 video content. It is significantly reduced in capability from
alternatives, but it does the job.
This also provides a framework for adding support for other H.264
software codecs provided through FFmpeg.
---
plugins/obs-ffmpeg/CMakeLists.txt | 1 +
plugins/obs-ffmpeg/cmake/legacy.cmake | 1 +
plugins/obs-ffmpeg/data/locale/en-US.ini | 3 +
plugins/obs-ffmpeg/obs-ffmpeg-h264.c | 260 +++++++++++++++++++++++
plugins/obs-ffmpeg/obs-ffmpeg.c | 2 +
5 files changed, 267 insertions(+)
create mode 100644 plugins/obs-ffmpeg/obs-ffmpeg-h264.c
diff --git a/plugins/obs-ffmpeg/CMakeLists.txt b/plugins/obs-ffmpeg/CMakeLists.txt
index 3eba00932..f97622c22 100644
--- a/plugins/obs-ffmpeg/CMakeLists.txt
+++ b/plugins/obs-ffmpeg/CMakeLists.txt
@@ -34,6 +34,7 @@ target_sources(
$<$<BOOL:${ENABLE_FFMPEG_LOGGING}>:obs-ffmpeg-logging.c>
obs-ffmpeg-audio-encoders.c
obs-ffmpeg-av1.c
+ obs-ffmpeg-h264.c
obs-ffmpeg-compat.h
obs-ffmpeg-formats.h
obs-ffmpeg-hls-mux.c
diff --git a/plugins/obs-ffmpeg/cmake/legacy.cmake b/plugins/obs-ffmpeg/cmake/legacy.cmake
index 5540676ea..62f2cc7a1 100644
--- a/plugins/obs-ffmpeg/cmake/legacy.cmake
+++ b/plugins/obs-ffmpeg/cmake/legacy.cmake
@@ -40,6 +40,7 @@ target_sources(
obs-ffmpeg-video-encoders.c
obs-ffmpeg-audio-encoders.c
obs-ffmpeg-av1.c
+ obs-ffmpeg-h264.c
obs-ffmpeg-nvenc.c
obs-ffmpeg-output.c
obs-ffmpeg-mux.c
diff --git a/plugins/obs-ffmpeg/data/locale/en-US.ini b/plugins/obs-ffmpeg/data/locale/en-US.ini
index 55bbe919d..0363ed82b 100644
--- a/plugins/obs-ffmpeg/data/locale/en-US.ini
+++ b/plugins/obs-ffmpeg/data/locale/en-US.ini
@@ -109,4 +109,7 @@ NVENC.CheckDrivers="Try installing the latest <a href=\"https://obsproject.com/g
AV1.8bitUnsupportedHdr="OBS does not support 8-bit output of Rec. 2100."
+H264.UnsupportedVideoFormat="Only video formats using 8-bit color are supported."
+H264.UnsupportedColorSpace="Only the Rec. 709 color space is supported."
+
ReconnectDelayTime="Reconnect Delay"
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-h264.c b/plugins/obs-ffmpeg/obs-ffmpeg-h264.c
new file mode 100644
index 000000000..179a61ccf
--- /dev/null
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-h264.c
@@ -0,0 +1,260 @@
+/******************************************************************************
+ Copyright (C) 2023 by Neal Gompa <neal@gompa.dev>
+ Partly derived from obs-ffmpeg-av1.c by Hugh Bailey <obs.jim@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+******************************************************************************/
+
+#include "obs-ffmpeg-video-encoders.h"
+
+#define do_log(level, format, ...) \
+ blog(level, "[H.264 encoder: '%s'] " format, \
+ obs_encoder_get_name(enc->ffve.encoder), ##__VA_ARGS__)
+
+#define error(format, ...) do_log(LOG_ERROR, format, ##__VA_ARGS__)
+#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__)
+#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__)
+#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__)
+
+enum h264_encoder_type {
+ H264_ENCODER_TYPE_OH264,
+};
+
+struct h264_encoder {
+ struct ffmpeg_video_encoder ffve;
+ enum h264_encoder_type type;
+
+ DARRAY(uint8_t) header;
+};
+
+static const char *oh264_getname(void *unused)
+{
+ UNUSED_PARAMETER(unused);
+ return "CPU: OpenH264";
+}
+
+static void h264_video_info(void *data, struct video_scale_info *info)
+{
+ UNUSED_PARAMETER(data);
+
+ // OpenH264 only supports I420
+ info->format = VIDEO_FORMAT_I420;
+}
+
+static bool h264_update(struct h264_encoder *enc, obs_data_t *settings)
+{
+ const char *profile = obs_data_get_string(settings, "profile");
+ int bitrate = (int)obs_data_get_int(settings, "bitrate");
+ int keyint_sec = 0; // This is not supported by OpenH264
+ const char *rc_mode = "quality"; // We only want to use quality mode
+ int allow_skip_frames = 1; // This is required for quality mode
+
+ video_t *video = obs_encoder_video(enc->ffve.encoder);
+ const struct video_output_info *voi = video_output_get_info(video);
+ struct video_scale_info info;
+
+ info.format = voi->format;
+ info.colorspace = voi->colorspace;
+ info.range = voi->range;
+
+ enc->ffve.context->thread_count = 0;
+
+ h264_video_info(enc, &info);
+
+ av_opt_set(enc->ffve.context->priv_data, "rc_mode", rc_mode, 0);
+ av_opt_set(enc->ffve.context->priv_data, "profile", profile, 0);
+ av_opt_set_int(enc->ffve.context->priv_data, "allow_skip_frames",
+ allow_skip_frames, 0);
+
+ const char *ffmpeg_opts = obs_data_get_string(settings, "ffmpeg_opts");
+ ffmpeg_video_encoder_update(&enc->ffve, bitrate, keyint_sec, voi, &info,
+ ffmpeg_opts);
+ info("settings:\n"
+ "\tencoder: %s\n"
+ "\trc_mode: %s\n"
+ "\tbitrate: %d\n"
+ "\tprofile: %s\n"
+ "\twidth: %d\n"
+ "\theight: %d\n"
+ "\tffmpeg opts: %s\n",
+ enc->ffve.enc_name, rc_mode, bitrate, profile,
+ enc->ffve.context->width, enc->ffve.height, ffmpeg_opts);
+
+ enc->ffve.context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+ return ffmpeg_video_encoder_init_codec(&enc->ffve);
+}
+
+static void h264_destroy(void *data)
+{
+ struct h264_encoder *enc = data;
+
+ ffmpeg_video_encoder_free(&enc->ffve);
+ da_free(enc->header);
+ bfree(enc);
+}
+
+static void on_first_packet(void *data, AVPacket *pkt, struct darray *da)
+{
+ struct h264_encoder *enc = data;
+
+ da_copy_array(enc->header, enc->ffve.context->extradata,
+ enc->ffve.context->extradata_size);
+
+ darray_copy_array(1, da, pkt->data, pkt->size);
+}
+
+static void *h264_create_internal(obs_data_t *settings, obs_encoder_t *encoder,
+ const char *enc_lib, const char *enc_name)
+{
+ video_t *video = obs_encoder_video(encoder);
+ const struct video_output_info *voi = video_output_get_info(video);
+
+ switch (voi->format) {
+ // planar 4:2:0 formats
+ case VIDEO_FORMAT_I420: // three-plane
+ case VIDEO_FORMAT_NV12: // two-plane, luma and packed chroma
+ // packed 4:2:2 formats
+ case VIDEO_FORMAT_YVYU:
+ case VIDEO_FORMAT_YUY2: // YUYV
+ case VIDEO_FORMAT_UYVY:
+ // packed uncompressed formats
+ case VIDEO_FORMAT_RGBA:
+ case VIDEO_FORMAT_BGRA:
+ case VIDEO_FORMAT_BGRX:
+ case VIDEO_FORMAT_BGR3:
+ case VIDEO_FORMAT_Y800: // grayscale
+ // planar 4:4:4
+ case VIDEO_FORMAT_I444:
+ // planar 4:2:2
+ case VIDEO_FORMAT_I422:
+ // planar 4:2:0 with alpha
+ case VIDEO_FORMAT_I40A:
+ // planar 4:2:2 with alpha
+ case VIDEO_FORMAT_I42A:
+ // planar 4:4:4 with alpha
+ case VIDEO_FORMAT_YUVA:
+ // packed 4:4:4 with alpha
+ case VIDEO_FORMAT_AYUV:
+ break;
+ default:; // Make the compiler do the right thing
+ const char *const text =
+ obs_module_text("H264.UnsupportedVideoFormat");
+ obs_encoder_set_last_error(encoder, text);
+ blog(LOG_ERROR, "[H.264 encoder] %s", text);
+ return NULL;
+ }
+
+ switch (voi->colorspace) {
+ case VIDEO_CS_DEFAULT:
+ case VIDEO_CS_709:
+ break;
+ default:; // Make the compiler do the right thing
+ const char *const text =
+ obs_module_text("H264.UnsupportedColorSpace");
+ obs_encoder_set_last_error(encoder, text);
+ blog(LOG_ERROR, "[H.264 encoder] %s", text);
+ return NULL;
+ }
+
+ struct h264_encoder *enc = bzalloc(sizeof(*enc));
+
+ if (strcmp(enc_lib, "libopenh264") == 0)
+ enc->type = H264_ENCODER_TYPE_OH264;
+
+ if (!ffmpeg_video_encoder_init(&enc->ffve, enc, encoder, enc_lib, NULL,
+ enc_name, NULL, on_first_packet))
+ goto fail;
+ if (!h264_update(enc, settings))
+ goto fail;
+
+ return enc;
+
+fail:
+ h264_destroy(enc);
+ return NULL;
+}
+
+static void *oh264_create(obs_data_t *settings, obs_encoder_t *encoder)
+{
+ return h264_create_internal(settings, encoder, "libopenh264",
+ "CPU: OpenH264");
+}
+
+static bool h264_encode(void *data, struct encoder_frame *frame,
+ struct encoder_packet *packet, bool *received_packet)
+{
+ struct h264_encoder *enc = data;
+ return ffmpeg_video_encode(&enc->ffve, frame, packet, received_packet);
+}
+
+void h264_defaults(obs_data_t *settings)
+{
+ obs_data_set_default_int(settings, "bitrate", 2500);
+ obs_data_set_default_string(settings, "profile", "main");
+}
+
+obs_properties_t *h264_properties(enum h264_encoder_type type)
+{
+ UNUSED_PARAMETER(type); // Only one encoder right now...
+ obs_properties_t *props = obs_properties_create();
+ obs_property_t *p;
+
+ p = obs_properties_add_list(props, "profile",
+ obs_module_text("Profile"),
+ OBS_COMBO_TYPE_LIST,
+ OBS_COMBO_FORMAT_STRING);
+ obs_property_list_add_string(p, "constrained_baseline",
+ "constrained_baseline");
+ obs_property_list_add_string(p, "main", "main");
+ obs_property_list_add_string(p, "high", "high");
+
+ p = obs_properties_add_int(props, "bitrate", obs_module_text("Bitrate"),
+ 50, 300000, 50);
+ obs_property_int_set_suffix(p, " Kbps");
+
+ obs_properties_add_text(props, "ffmpeg_opts",
+ obs_module_text("FFmpegOpts"),
+ OBS_TEXT_DEFAULT);
+
+ return props;
+}
+
+obs_properties_t *oh264_properties(void *unused)
+{
+ UNUSED_PARAMETER(unused);
+ return h264_properties(H264_ENCODER_TYPE_OH264);
+}
+
+static bool h264_extra_data(void *data, uint8_t **extra_data, size_t *size)
+{
+ struct h264_encoder *enc = data;
+
+ *extra_data = enc->header.array;
+ *size = enc->header.num;
+ return true;
+}
+
+struct obs_encoder_info oh264_encoder_info = {
+ .id = "ffmpeg_openh264",
+ .type = OBS_ENCODER_VIDEO,
+ .codec = "h264",
+ .get_name = oh264_getname,
+ .create = oh264_create,
+ .destroy = h264_destroy,
+ .encode = h264_encode,
+ .get_defaults = h264_defaults,
+ .get_properties = oh264_properties,
+ .get_extra_data = h264_extra_data,
+ .get_video_info = h264_video_info,
+};
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg.c b/plugins/obs-ffmpeg/obs-ffmpeg.c
index da0b2c2b4..a01a729c8 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg.c
@@ -39,6 +39,7 @@ extern struct obs_encoder_info pcm24_encoder_info;
extern struct obs_encoder_info pcm32_encoder_info;
extern struct obs_encoder_info alac_encoder_info;
extern struct obs_encoder_info flac_encoder_info;
+extern struct obs_encoder_info oh264_encoder_info;
extern struct obs_encoder_info h264_nvenc_encoder_info;
#ifdef ENABLE_HEVC
extern struct obs_encoder_info hevc_nvenc_encoder_info;
@@ -387,6 +388,7 @@ bool obs_module_load(void)
obs_register_output(&ffmpeg_hls_muxer);
obs_register_output(&replay_buffer);
obs_register_encoder(&aac_encoder_info);
+ register_encoder_if_available(&oh264_encoder_info, "libopenh264");
register_encoder_if_available(&svt_av1_encoder_info, "libsvtav1");
register_encoder_if_available(&aom_av1_encoder_info, "libaom-av1");
obs_register_encoder(&opus_encoder_info);
--
2.39.2

View File

@ -1,63 +0,0 @@
From 8e5fec4c7765b1c43d40f652b46d034340877a31 Mon Sep 17 00:00:00 2001
From: Ryan Foster <ryan@obsproject.com>
Date: Fri, 14 Apr 2023 12:05:59 -0400
Subject: [PATCH 1/2] obs-ffmpeg: Use 2x2 tiles in NVENC AV1 for 4K+
When resolution is 4K or higher, use 2x2 uniform tiles for NVENC AV1.
---
plugins/obs-ffmpeg/jim-nvenc.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/plugins/obs-ffmpeg/jim-nvenc.c b/plugins/obs-ffmpeg/jim-nvenc.c
index 10a7dd18549b9..c1e8bee154770 100644
--- a/plugins/obs-ffmpeg/jim-nvenc.c
+++ b/plugins/obs-ffmpeg/jim-nvenc.c
@@ -922,6 +922,17 @@ static bool init_encoder_av1(struct nvenc_data *enc, obs_data_t *settings,
if (config->rcParams.rateControlMode == NV_ENC_PARAMS_RC_CBR)
av1_config->enableBitstreamPadding = 1;
+#define FOUR_K_CX 3840
+#define FOUR_K_CY 2160
+#define PIXELCOUNT_4K (FOUR_K_CX * FOUR_K_CY)
+
+ /* If 4K+, set tiles to 2x2 uniform tiles. */
+ if ((voi->width * voi->height) >= PIXELCOUNT_4K) {
+ av1_config->enableCustomTileConfig = 0;
+ av1_config->numTileColumns = 2;
+ av1_config->numTileRows = 2;
+ }
+
switch (voi->colorspace) {
case VIDEO_CS_601:
av1_config->colorPrimaries = 6;
From 872f0353e68191d69bcc4678a2d195144fdcabeb Mon Sep 17 00:00:00 2001
From: Ryan Foster <ryan@obsproject.com>
Date: Fri, 14 Apr 2023 12:07:50 -0400
Subject: [PATCH 2/2] obs-ffmpeg: Use 2 tiles per frame in AMF AV1 for 4K+
When resolution is 4K or higher, use 2 tiles per frame in AMF AV1.
---
plugins/obs-ffmpeg/texture-amf.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/plugins/obs-ffmpeg/texture-amf.cpp b/plugins/obs-ffmpeg/texture-amf.cpp
index 88914a027f699..5979b903385ad 100644
--- a/plugins/obs-ffmpeg/texture-amf.cpp
+++ b/plugins/obs-ffmpeg/texture-amf.cpp
@@ -2018,6 +2018,15 @@ static void amf_av1_create_internal(amf_base *enc, obs_data_t *settings)
const bool is10bit = enc->amf_format == AMF_SURFACE_P010;
const char *preset = obs_data_get_string(settings, "preset");
+ constexpr uint32_t four_k_cx = 3840;
+ constexpr uint32_t four_k_cy = 2160;
+ constexpr uint32_t pixelcount_4k = four_k_cx * four_k_cy;
+
+ /* If 4K+, set tiles per frame to 2. */
+ if ((enc->cx * enc->cy) >= pixelcount_4k) {
+ set_av1_property(enc, TILES_PER_FRAME, 2);
+ }
+
set_av1_property(enc, FRAMESIZE, AMFConstructSize(enc->cx, enc->cy));
set_av1_property(enc, USAGE, AMF_VIDEO_ENCODER_USAGE_TRANSCODING);
set_av1_property(enc, ALIGNMENT_MODE,

View File

@ -0,0 +1,545 @@
From 30f84455969071ff9aa826a44438a0402dd15123 Mon Sep 17 00:00:00 2001
From: Neal Gompa <neal@gompa.dev>
Date: Tue, 28 Mar 2023 05:08:49 -0400
Subject: [PATCH 3/3] UI: Add support for OpenH264 as the worst-case fallback
OpenH264 exists as the codec of last resort, so it is implemented
such that it is only used as the software codec if x264 is not
available.
---
UI/data/locale/en-US.ini | 1 +
UI/window-basic-auto-config-test.cpp | 50 +++++++++++++++++++---------
UI/window-basic-auto-config.cpp | 15 ++++++++-
UI/window-basic-auto-config.hpp | 3 ++
UI/window-basic-main-outputs.cpp | 6 ++--
UI/window-basic-main-profiles.cpp | 34 +++++++++++--------
UI/window-basic-main.cpp | 20 +++++++----
UI/window-basic-main.hpp | 3 +-
UI/window-basic-settings-stream.cpp | 16 ++++++---
UI/window-basic-settings.cpp | 23 ++++++++++---
10 files changed, 123 insertions(+), 48 deletions(-)
diff --git a/UI/data/locale/en-US.ini b/UI/data/locale/en-US.ini
index e44d99660..a5ba5d661 100644
--- a/UI/data/locale/en-US.ini
+++ b/UI/data/locale/en-US.ini
@@ -980,6 +980,7 @@ Basic.Settings.Output.Simple.Warn.Encoder="Warning: Recording with a software en
Basic.Settings.Output.Simple.Warn.Lossless="Warning: Lossless quality generates tremendously large file sizes! Lossless quality can use upward of 7 gigabytes of disk space per minute at high resolutions and framerates. Lossless is not recommended for long recordings unless you have a very large amount of disk space available."
Basic.Settings.Output.Simple.Warn.Lossless.Msg="Are you sure you want to use lossless quality?"
Basic.Settings.Output.Simple.Warn.Lossless.Title="Lossless quality warning!"
+Basic.Settings.Output.Simple.Encoder.Software.OpenH264.H264="Software (OpenH264)"
Basic.Settings.Output.Simple.Encoder.Software.X264.H264="Software (x264)"
Basic.Settings.Output.Simple.Encoder.Hardware.QSV.H264="Hardware (QSV, H.264)"
Basic.Settings.Output.Simple.Encoder.Hardware.QSV.AV1="Hardware (QSV, AV1)"
diff --git a/UI/window-basic-auto-config-test.cpp b/UI/window-basic-auto-config-test.cpp
index 09979c031..c791c8b8b 100644
--- a/UI/window-basic-auto-config-test.cpp
+++ b/UI/window-basic-auto-config-test.cpp
@@ -199,7 +199,8 @@ void AutoConfigTestPage::TestBandwidthThread()
: "rtmp_common";
OBSEncoderAutoRelease vencoder = obs_video_encoder_create(
- "obs_x264", "test_x264", nullptr, nullptr);
+ (wiz->x264Available ? "obs_x264" : "ffmpeg_openh264"),
+ "test_h264", nullptr, nullptr);
OBSEncoderAutoRelease aencoder = obs_audio_encoder_create(
"ffmpeg_aac", "test_aac", nullptr, 0, nullptr);
OBSServiceAutoRelease service = obs_service_create(
@@ -238,10 +239,11 @@ void AutoConfigTestPage::TestBandwidthThread()
obs_data_set_string(service_settings, "key", key.c_str());
obs_data_set_int(vencoder_settings, "bitrate", wiz->startingBitrate);
- obs_data_set_string(vencoder_settings, "rate_control", "CBR");
- obs_data_set_string(vencoder_settings, "preset", "veryfast");
- obs_data_set_int(vencoder_settings, "keyint_sec", 2);
-
+ if (wiz->x264Available) {
+ obs_data_set_string(vencoder_settings, "rate_control", "CBR");
+ obs_data_set_string(vencoder_settings, "preset", "veryfast");
+ obs_data_set_int(vencoder_settings, "keyint_sec", 2);
+ }
obs_data_set_int(aencoder_settings, "bitrate", 32);
OBSBasic *main = reinterpret_cast<OBSBasic *>(App()->GetMainWindow());
@@ -567,7 +569,8 @@ bool AutoConfigTestPage::TestSoftwareEncoding()
/* create obs objects */
OBSEncoderAutoRelease vencoder = obs_video_encoder_create(
- "obs_x264", "test_x264", nullptr, nullptr);
+ (wiz->x264Available ? "obs_x264" : "ffmpeg_openh264"),
+ "test_h264", nullptr, nullptr);
OBSEncoderAutoRelease aencoder = obs_audio_encoder_create(
"ffmpeg_aac", "test_aac", nullptr, 0, nullptr);
OBSOutputAutoRelease output =
@@ -581,17 +584,25 @@ bool AutoConfigTestPage::TestSoftwareEncoding()
obs_data_set_int(aencoder_settings, "bitrate", 32);
if (wiz->type != AutoConfig::Type::Recording) {
- obs_data_set_int(vencoder_settings, "keyint_sec", 2);
+ if (wiz->x264Available) {
+ obs_data_set_int(vencoder_settings, "keyint_sec", 2);
+ obs_data_set_string(vencoder_settings, "rate_control",
+ "CBR");
+ obs_data_set_string(vencoder_settings, "preset",
+ "veryfast");
+ }
obs_data_set_int(vencoder_settings, "bitrate",
wiz->idealBitrate);
- obs_data_set_string(vencoder_settings, "rate_control", "CBR");
obs_data_set_string(vencoder_settings, "profile", "main");
- obs_data_set_string(vencoder_settings, "preset", "veryfast");
} else {
- obs_data_set_int(vencoder_settings, "crf", 20);
- obs_data_set_string(vencoder_settings, "rate_control", "CRF");
+ if (wiz->x264Available) {
+ obs_data_set_int(vencoder_settings, "crf", 20);
+ obs_data_set_string(vencoder_settings, "rate_control",
+ "CRF");
+ obs_data_set_string(vencoder_settings, "preset",
+ "veryfast");
+ }
obs_data_set_string(vencoder_settings, "profile", "high");
- obs_data_set_string(vencoder_settings, "preset", "veryfast");
}
/* -----------------------------------*/
@@ -944,7 +955,10 @@ void AutoConfigTestPage::TestStreamEncoderThread()
else
wiz->streamingEncoder = AutoConfig::Encoder::AMD;
} else {
- wiz->streamingEncoder = AutoConfig::Encoder::x264;
+ if (wiz->x264Available)
+ wiz->streamingEncoder = AutoConfig::Encoder::x264;
+ else
+ wiz->streamingEncoder = AutoConfig::Encoder::OpenH264;
}
if (preferHardware && !softwareTested && wiz->hardwareEncodingAvailable)
@@ -979,7 +993,10 @@ void AutoConfigTestPage::TestRecordingEncoderThread()
else
wiz->recordingEncoder = AutoConfig::Encoder::AMD;
} else {
- wiz->recordingEncoder = AutoConfig::Encoder::x264;
+ if (wiz->x264Available)
+ wiz->streamingEncoder = AutoConfig::Encoder::x264;
+ else
+ wiz->streamingEncoder = AutoConfig::Encoder::OpenH264;
}
if (wiz->recordingEncoder != AutoConfig::Encoder::NVENC) {
@@ -993,6 +1010,7 @@ void AutoConfigTestPage::TestRecordingEncoderThread()
}
#define ENCODER_TEXT(x) "Basic.Settings.Output.Simple.Encoder." x
+#define ENCODER_OPENH264 ENCODER_TEXT("Software.OpenH264.H264")
#define ENCODER_X264 ENCODER_TEXT("Software.X264.H264")
#define ENCODER_NVENC ENCODER_TEXT("Hardware.NVENC.H264")
#define ENCODER_QSV ENCODER_TEXT("Hardware.QSV.H264")
@@ -1032,6 +1050,8 @@ void AutoConfigTestPage::FinalizeResults()
auto encName = [](AutoConfig::Encoder enc) -> QString {
switch (enc) {
+ case AutoConfig::Encoder::OpenH264:
+ return QTStr(ENCODER_OPENH264);
case AutoConfig::Encoder::x264:
return QTStr(ENCODER_X264);
case AutoConfig::Encoder::NVENC:
@@ -1046,7 +1066,7 @@ void AutoConfigTestPage::FinalizeResults()
return QTStr(QUALITY_SAME);
}
- return QTStr(ENCODER_X264);
+ return QTStr(ENCODER_OPENH264);
};
auto newLabel = [this](const char *str) -> QLabel * {
diff --git a/UI/window-basic-auto-config.cpp b/UI/window-basic-auto-config.cpp
index 3e9c36685..eace18067 100644
--- a/UI/window-basic-auto-config.cpp
+++ b/UI/window-basic-auto-config.cpp
@@ -961,6 +961,7 @@ AutoConfig::AutoConfig(QWidget *parent) : QWizard(parent)
streamPage->ui->bitrate->setValue(bitrate);
streamPage->ServiceChanged();
+ TestSoftwareEncoding();
TestHardwareEncoding();
if (!hardwareEncodingAvailable) {
delete streamPage->ui->preferHardware;
@@ -989,6 +990,16 @@ AutoConfig::~AutoConfig()
EnableThreadedMessageBoxes(false);
}
+void AutoConfig::TestSoftwareEncoding()
+{
+ size_t idx = 0;
+ const char *id;
+ while (obs_enum_encoder_types(idx++, &id)) {
+ if (strcmp(id, "obs_x264") == 0)
+ x264Available = true;
+ }
+}
+
void AutoConfig::TestHardwareEncoding()
{
size_t idx = 0;
@@ -1061,8 +1072,10 @@ inline const char *AutoConfig::GetEncoderId(Encoder enc)
return SIMPLE_ENCODER_AMD;
case Encoder::Apple:
return SIMPLE_ENCODER_APPLE_H264;
- default:
+ case Encoder::x264:
return SIMPLE_ENCODER_X264;
+ default:
+ return SIMPLE_ENCODER_OPENH264;
}
};
diff --git a/UI/window-basic-auto-config.hpp b/UI/window-basic-auto-config.hpp
index eb50701ff..e581791dd 100644
--- a/UI/window-basic-auto-config.hpp
+++ b/UI/window-basic-auto-config.hpp
@@ -43,6 +43,7 @@ class AutoConfig : public QWizard {
};
enum class Encoder {
+ OpenH264,
x264,
NVENC,
QSV,
@@ -91,6 +92,7 @@ class AutoConfig : public QWizard {
bool qsvAvailable = false;
bool vceAvailable = false;
bool appleAvailable = false;
+ bool x264Available = false;
int startingBitrate = 2500;
bool customServer = false;
@@ -106,6 +108,7 @@ class AutoConfig : public QWizard {
int specificFPSNum = 0;
int specificFPSDen = 0;
+ void TestSoftwareEncoding();
void TestHardwareEncoding();
bool CanTestServer(const char *server);
diff --git a/UI/window-basic-main-outputs.cpp b/UI/window-basic-main-outputs.cpp
index 737ab966d..a4df630c4 100644
--- a/UI/window-basic-main-outputs.cpp
+++ b/UI/window-basic-main-outputs.cpp
@@ -515,7 +515,9 @@ void SimpleOutput::LoadStreamingPreset_Lossy(const char *encoderId)
/* mistakes have been made to lead us to this. */
const char *get_simple_output_encoder(const char *encoder)
{
- if (strcmp(encoder, SIMPLE_ENCODER_X264) == 0) {
+ if (strcmp(encoder, SIMPLE_ENCODER_OPENH264) == 0) {
+ return "ffmpeg_openh264";
+ } else if (strcmp(encoder, SIMPLE_ENCODER_X264) == 0) {
return "obs_x264";
} else if (strcmp(encoder, SIMPLE_ENCODER_X264_LOWCPU) == 0) {
return "obs_x264";
@@ -549,7 +551,7 @@ const char *get_simple_output_encoder(const char *encoder)
#endif
}
- return "obs_x264";
+ return "ffmpeg_openh264";
}
void SimpleOutput::LoadRecordingPreset()
diff --git a/UI/window-basic-main-profiles.cpp b/UI/window-basic-main-profiles.cpp
index 4941359ea..1f3ffdc1d 100644
--- a/UI/window-basic-main-profiles.cpp
+++ b/UI/window-basic-main-profiles.cpp
@@ -794,7 +794,7 @@ void OBSBasic::ChangeProfile()
Auth::Load();
- CheckForSimpleModeX264Fallback();
+ CheckForSimpleModeH264Fallback();
blog(LOG_INFO, "Switched to profile '%s' (%s)", newName, newDir);
blog(LOG_INFO, "------------------------------------------------");
@@ -815,12 +815,13 @@ void OBSBasic::ChangeProfile()
}
}
-void OBSBasic::CheckForSimpleModeX264Fallback()
+void OBSBasic::CheckForSimpleModeH264Fallback()
{
const char *curStreamEncoder =
config_get_string(basicConfig, "SimpleOutput", "StreamEncoder");
const char *curRecEncoder =
config_get_string(basicConfig, "SimpleOutput", "RecEncoder");
+ bool x264_supported = false;
bool qsv_supported = false;
bool qsv_av1_supported = false;
bool amd_supported = false;
@@ -849,7 +850,9 @@ void OBSBasic::CheckForSimpleModeX264Fallback()
const char *id;
while (obs_enum_encoder_types(idx++, &id)) {
- if (strcmp(id, "h264_texture_amf") == 0)
+ if (strcmp(id, "obs_x264") == 0)
+ x264_supported = true;
+ else if (strcmp(id, "h264_texture_amf") == 0)
amd_supported = true;
else if (strcmp(id, "obs_qsv11") == 0)
qsv_supported = true;
@@ -865,68 +868,73 @@ void OBSBasic::CheckForSimpleModeX264Fallback()
#endif
}
+ // Check to see whether x264 is available
+ const char *fallback_encoder_name = (x264_supported
+ ? SIMPLE_ENCODER_X264
+ : SIMPLE_ENCODER_OPENH264);
+
auto CheckEncoder = [&](const char *&name) {
if (strcmp(name, SIMPLE_ENCODER_QSV) == 0) {
if (!qsv_supported) {
changed = true;
- name = SIMPLE_ENCODER_X264;
+ name = fallback_encoder_name;
return false;
}
} else if (strcmp(name, SIMPLE_ENCODER_QSV_AV1) == 0) {
if (!qsv_av1_supported) {
changed = true;
- name = SIMPLE_ENCODER_X264;
+ name = fallback_encoder_name;
return false;
}
} else if (strcmp(name, SIMPLE_ENCODER_NVENC) == 0) {
if (!nve_supported) {
changed = true;
- name = SIMPLE_ENCODER_X264;
+ name = fallback_encoder_name;
return false;
}
} else if (strcmp(name, SIMPLE_ENCODER_NVENC_AV1) == 0) {
if (!nve_supported) {
changed = true;
- name = SIMPLE_ENCODER_X264;
+ name = fallback_encoder_name;
return false;
}
#ifdef ENABLE_HEVC
} else if (strcmp(name, SIMPLE_ENCODER_AMD_HEVC) == 0) {
if (!amd_hevc_supported) {
changed = true;
- name = SIMPLE_ENCODER_X264;
+ name = fallback_encoder_name;
return false;
}
} else if (strcmp(name, SIMPLE_ENCODER_NVENC_HEVC) == 0) {
if (!nve_hevc_supported) {
changed = true;
- name = SIMPLE_ENCODER_X264;
+ name = fallback_encoder_name;
return false;
}
#endif
} else if (strcmp(name, SIMPLE_ENCODER_AMD) == 0) {
if (!amd_supported) {
changed = true;
- name = SIMPLE_ENCODER_X264;
+ name = fallback_encoder_name;
return false;
}
} else if (strcmp(name, SIMPLE_ENCODER_AMD_AV1) == 0) {
if (!amd_av1_supported) {
changed = true;
- name = SIMPLE_ENCODER_X264;
+ name = fallback_encoder_name;
return false;
}
} else if (strcmp(name, SIMPLE_ENCODER_APPLE_H264) == 0) {
if (!apple_supported) {
changed = true;
- name = SIMPLE_ENCODER_X264;
+ name = fallback_encoder_name;
return false;
}
#ifdef ENABLE_HEVC
} else if (strcmp(name, SIMPLE_ENCODER_APPLE_HEVC) == 0) {
if (!apple_hevc_supported) {
changed = true;
- name = SIMPLE_ENCODER_X264;
+ name = fallback_encoder_name;
return false;
}
#endif
diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp
index 6d9375eb4..c6aae8c7b 100644
--- a/UI/window-basic-main.cpp
+++ b/UI/window-basic-main.cpp
@@ -1379,6 +1379,8 @@ extern void CheckExistingCookieId();
#define DEFAULT_CONTAINER "fragmented_mp4"
#endif
+extern bool EncoderAvailable(const char *encoder);
+
bool OBSBasic::InitBasicConfigDefaults()
{
QList<QScreen *> screens = QGuiApplication::screens();
@@ -1549,7 +1551,10 @@ bool OBSBasic::InitBasicConfigDefaults()
config_set_default_bool(basicConfig, "AdvOut", "UseRescale", false);
config_set_default_uint(basicConfig, "AdvOut", "TrackIndex", 1);
config_set_default_uint(basicConfig, "AdvOut", "VodTrackIndex", 2);
- config_set_default_string(basicConfig, "AdvOut", "Encoder", "obs_x264");
+
+ bool useX264 = EncoderAvailable("obs_x264");
+ config_set_default_string(basicConfig, "AdvOut", "Encoder",
+ (useX264 ? "obs_x264" : "ffmpeg_openh264"));
config_set_default_string(basicConfig, "AdvOut", "RecType", "Standard");
@@ -1672,7 +1677,6 @@ bool OBSBasic::InitBasicConfigDefaults()
return true;
}
-extern bool EncoderAvailable(const char *encoder);
extern bool update_nvenc_presets(ConfigFile &config);
void OBSBasic::InitBasicConfigDefaults2()
@@ -1681,12 +1685,14 @@ void OBSBasic::InitBasicConfigDefaults2()
"Pre23Defaults");
bool useNV = EncoderAvailable("ffmpeg_nvenc") && !oldEncDefaults;
+ bool useX264 = EncoderAvailable("obs_x264");
+ const char *h264_fallback =
+ (useX264 ? SIMPLE_ENCODER_X264 : SIMPLE_ENCODER_OPENH264);
+
config_set_default_string(basicConfig, "SimpleOutput", "StreamEncoder",
- useNV ? SIMPLE_ENCODER_NVENC
- : SIMPLE_ENCODER_X264);
+ useNV ? SIMPLE_ENCODER_NVENC : h264_fallback);
config_set_default_string(basicConfig, "SimpleOutput", "RecEncoder",
- useNV ? SIMPLE_ENCODER_NVENC
- : SIMPLE_ENCODER_X264);
+ useNV ? SIMPLE_ENCODER_NVENC : h264_fallback);
const char *aac_default = "ffmpeg_aac";
if (EncoderAvailable("CoreAudio_AAC"))
@@ -1967,7 +1973,7 @@ void OBSBasic::OBSInit()
InitBasicConfigDefaults2();
- CheckForSimpleModeX264Fallback();
+ CheckForSimpleModeH264Fallback();
blog(LOG_INFO, STARTUP_SEPARATOR);
diff --git a/UI/window-basic-main.hpp b/UI/window-basic-main.hpp
index cbce69832..74c6eb144 100644
--- a/UI/window-basic-main.hpp
+++ b/UI/window-basic-main.hpp
@@ -66,6 +66,7 @@ class OBSBasicVCamConfig;
#define SIMPLE_ENCODER_X264 "x264"
#define SIMPLE_ENCODER_X264_LOWCPU "x264_lowcpu"
+#define SIMPLE_ENCODER_OPENH264 "ffmpeg_openh264"
#define SIMPLE_ENCODER_QSV "qsv"
#define SIMPLE_ENCODER_QSV_AV1 "qsv_av1"
#define SIMPLE_ENCODER_NVENC "nvenc"
@@ -434,7 +435,7 @@ private:
void DeleteProfile(const char *profile_name, const char *profile_dir);
void RefreshProfiles();
void ChangeProfile();
- void CheckForSimpleModeX264Fallback();
+ void CheckForSimpleModeH264Fallback();
void SaveProjectNow();
diff --git a/UI/window-basic-settings-stream.cpp b/UI/window-basic-settings-stream.cpp
index b056938e7..548e5f45f 100644
--- a/UI/window-basic-settings-stream.cpp
+++ b/UI/window-basic-settings-stream.cpp
@@ -1362,7 +1362,9 @@ static QString get_adv_fallback(const QString &enc)
return "com.apple.videotoolbox.videoencoder.ave.avc";
if (enc == "obs_qsv11_av1")
return "obs_qsv11";
- return "obs_x264";
+ if (EncoderAvailable("obs_x264"))
+ return "obs_x264";
+ return "ffmpeg_openh264";
}
static QString get_adv_audio_fallback(const QString &enc)
@@ -1391,7 +1393,9 @@ static QString get_simple_fallback(const QString &enc)
return SIMPLE_ENCODER_APPLE_H264;
if (enc == SIMPLE_ENCODER_QSV_AV1)
return SIMPLE_ENCODER_QSV;
- return SIMPLE_ENCODER_X264;
+ if (EncoderAvailable("obs_x264"))
+ return SIMPLE_ENCODER_X264;
+ return SIMPLE_ENCODER_OPENH264;
}
bool OBSBasicSettings::ServiceSupportsCodecCheck()
@@ -1670,8 +1674,12 @@ void OBSBasicSettings::ResetEncoders(bool streamOnly)
#define ENCODER_STR(str) QTStr("Basic.Settings.Output.Simple.Encoder." str)
- ui->simpleOutStrEncoder->addItem(ENCODER_STR("Software.X264.H264"),
- QString(SIMPLE_ENCODER_X264));
+ ui->simpleOutStrEncoder->addItem(ENCODER_STR("Software.OpenH264.H264"),
+ QString(SIMPLE_ENCODER_OPENH264));
+ if (service_supports_encoder(vcodecs, "obs_x264"))
+ ui->simpleOutStrEncoder->addItem(
+ ENCODER_STR("Software.X264.H264"),
+ QString(SIMPLE_ENCODER_X264));
#ifdef _WIN32
if (service_supports_encoder(vcodecs, "obs_qsv11"))
ui->simpleOutStrEncoder->addItem(
diff --git a/UI/window-basic-settings.cpp b/UI/window-basic-settings.cpp
index 48bb4bac6..51fe280db 100644
--- a/UI/window-basic-settings.cpp
+++ b/UI/window-basic-settings.cpp
@@ -3831,6 +3831,11 @@ void OBSBasicSettings::SaveOutputSettings()
do. This only exists to make sure that the x264 preset doesn't
get overwritten with empty data. */
presetType = "ApplePreset";
+ else if (encoder == SIMPLE_ENCODER_OPENH264)
+ /* The OpenH264 encoder does not have presets like the other encoders
+ do. This only exists to make sure that the x264 preset doesn't
+ get overwritten with empty data. */
+ presetType = "OpenH264Preset";
else
presetType = "Preset";
@@ -5286,11 +5291,16 @@ void OBSBasicSettings::FillSimpleRecordingValues()
ADD_QUALITY("HQ");
ADD_QUALITY("Lossless");
- ui->simpleOutRecEncoder->addItem(ENCODER_STR("Software.X264.H264"),
- QString(SIMPLE_ENCODER_X264));
- ui->simpleOutRecEncoder->addItem(
- ENCODER_STR("SoftwareLowCPU.X264.H264"),
- QString(SIMPLE_ENCODER_X264_LOWCPU));
+ ui->simpleOutRecEncoder->addItem(ENCODER_STR("Software.OpenH264.H264"),
+ QString(SIMPLE_ENCODER_OPENH264));
+ if (EncoderAvailable("obs_x264")) {
+ ui->simpleOutRecEncoder->addItem(
+ ENCODER_STR("Software.X264.H264"),
+ QString(SIMPLE_ENCODER_X264));
+ ui->simpleOutRecEncoder->addItem(
+ ENCODER_STR("SoftwareLowCPU.X264.H264"),
+ QString(SIMPLE_ENCODER_X264_LOWCPU));
+ }
if (EncoderAvailable("obs_qsv11"))
ui->simpleOutRecEncoder->addItem(
ENCODER_STR("Hardware.QSV.H264"),
@@ -5463,6 +5473,9 @@ void OBSBasicSettings::SimpleStreamingEncoderChanged()
defaultPreset = "balanced";
preset = curAMDAV1Preset;
+ } else if (encoder == SIMPLE_ENCODER_OPENH264) {
+ ui->simpleOutPreset->setVisible(false);
+ ui->simpleOutPresetLabel->setVisible(false);
} else {
#define PRESET_STR(val) \
--
2.39.2

View File

@ -1,27 +0,0 @@
From 5fdda179ed2768304a98d48f4074e54fe7cbf5b3 Mon Sep 17 00:00:00 2001
From: David Rosca <nowrep@gmail.com>
Date: Fri, 30 Jun 2023 07:23:41 +0200
Subject: [PATCH] obs-ffmpeg: Increase initial buffer fullness for VAAPI
Default ffmpeg initial buffer fullness (75%) is too low
and results in significantly lower video quality on AMD cards.
Changing it to 100% fixes the quality and also matches what
AMF encoder is doing.
---
plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
index c5aa0128a54b9..1a6ecd63ae4d4 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
@@ -300,6 +300,8 @@ static bool vaapi_update(void *data, obs_data_t *settings, bool hevc)
enc->context->level = level;
enc->context->bit_rate = bitrate * 1000;
enc->context->rc_max_rate = maxrate * 1000;
+ enc->context->rc_initial_buffer_occupancy =
+ (maxrate ? maxrate : bitrate) * 1000;
enc->context->width = obs_encoder_get_width(enc->encoder);
enc->context->height = obs_encoder_get_height(enc->encoder);

283
patches/8051.patch Normal file
View File

@ -0,0 +1,283 @@
From 01f0cab97d222f5cd4d7468f730370e76f08b42a Mon Sep 17 00:00:00 2001
From: CodeYan01 <65320293+CodeYan01@users.noreply.github.com>
Date: Thu, 12 Jan 2023 01:01:14 +0800
Subject: [PATCH] UI: Refactor editable list modification
Previously would unnecessarily recreating the data array for every
modification (adding/removing/reordering/editing). This clears the
fields in the associated data array that other code/scripts would add,
such as an ID field for each item that could be used to distinguish
each item from their duplicates in the list.
I initially wanted to remove EditableListChanged, but it no longer saved
the item selection whenever the list is modified, so I kept the function
and just changed it to update the selected state in the data array.
---
UI/properties-view.cpp | 97 +++++++++++++++++++++++++++++++++++++-----
UI/properties-view.hpp | 6 +++
2 files changed, 93 insertions(+), 10 deletions(-)
diff --git a/UI/properties-view.cpp b/UI/properties-view.cpp
index 7d8838b3603a2..025b104d0db27 100644
--- a/UI/properties-view.cpp
+++ b/UI/properties-view.cpp
@@ -709,6 +709,11 @@ void OBSPropertiesView::AddEditableList(obs_property_t *prop,
{
const char *name = obs_property_name(prop);
OBSDataArrayAutoRelease array = obs_data_get_array(settings, name);
+ if (array == NULL) {
+ array = obs_data_array_create();
+ obs_data_set_array(settings, name, array);
+ }
+
QListWidget *list = new QListWidget();
size_t count = obs_data_array_count(array);
@@ -731,8 +736,8 @@ void OBSPropertiesView::AddEditableList(obs_property_t *prop,
WidgetInfo *info = new WidgetInfo(this, prop, list);
list->setDragDropMode(QAbstractItemView::InternalMove);
- connect(list->model(), &QAbstractItemModel::rowsMoved,
- [info]() { info->EditableListChanged(); });
+ connect(list->model(), &QAbstractItemModel::rowsMoved, info,
+ &WidgetInfo::EditListReordered);
QVBoxLayout *sideLayout = new QVBoxLayout();
NewButton(sideLayout, info, "addIconSmall", &WidgetInfo::EditListAdd);
@@ -1992,24 +1997,52 @@ void WidgetInfo::GroupChanged(const char *setting)
: true);
}
+void WidgetInfo::EditListReordered(const QModelIndex &sourceParent,
+ int sourceStart, int sourceEnd,
+ const QModelIndex &destinationParent,
+ int destinationRow)
+{
+ UNUSED_PARAMETER(sourceParent);
+ UNUSED_PARAMETER(destinationParent);
+
+ const char *setting = obs_property_name(property);
+ OBSDataArrayAutoRelease array =
+ obs_data_get_array(view->settings, setting);
+
+ for (int i = sourceStart; i <= sourceEnd; i++) {
+ OBSDataAutoRelease arrayItem = obs_data_array_item(array, i);
+ obs_data_array_insert(array, destinationRow, arrayItem);
+ // if moved to top, destination row increases
+ obs_data_array_erase(array, (i > destinationRow) ? i + 1 : i);
+ ++destinationRow;
+ }
+ EditableListChanged();
+}
+
+void WidgetInfo::EditableListArrayPushBack(obs_data_array_t *array,
+ const char *text)
+{
+ OBSDataAutoRelease arrayItem = obs_data_create();
+ obs_data_set_string(arrayItem, "value", text);
+ obs_data_set_bool(arrayItem, "selected", false);
+ obs_data_set_bool(arrayItem, "hidden", false);
+ obs_data_array_push_back(array, arrayItem);
+}
+
void WidgetInfo::EditableListChanged()
{
const char *setting = obs_property_name(property);
QListWidget *list = reinterpret_cast<QListWidget *>(widget);
- OBSDataArrayAutoRelease array = obs_data_array_create();
+ OBSDataArrayAutoRelease array =
+ obs_data_get_array(view->settings, setting);
for (int i = 0; i < list->count(); i++) {
QListWidgetItem *item = list->item(i);
- OBSDataAutoRelease arrayItem = obs_data_create();
- obs_data_set_string(arrayItem, "value",
- QT_TO_UTF8(item->text()));
+ OBSDataAutoRelease arrayItem = obs_data_array_item(array, i);
obs_data_set_bool(arrayItem, "selected", item->isSelected());
obs_data_set_bool(arrayItem, "hidden", item->isHidden());
- obs_data_array_push_back(array, arrayItem);
}
- obs_data_set_array(view->settings, setting, array);
-
ControlChanged();
}
@@ -2263,6 +2296,9 @@ void WidgetInfo::EditListAddText()
{
QListWidget *list = reinterpret_cast<QListWidget *>(widget);
const char *desc = obs_property_description(property);
+ const char *setting = obs_property_name(property);
+ OBSDataArrayAutoRelease array =
+ obs_data_get_array(view->settings, setting);
EditableItemDialog dialog(widget->window(), QString(), false);
auto title = QTStr("Basic.PropertiesWindow.AddEditableListEntry")
@@ -2276,6 +2312,7 @@ void WidgetInfo::EditListAddText()
return;
list->addItem(text);
+ EditableListArrayPushBack(array, QT_TO_UTF8(text));
EditableListChanged();
}
@@ -2286,6 +2323,9 @@ void WidgetInfo::EditListAddFiles()
const char *filter = obs_property_editable_list_filter(property);
const char *default_path =
obs_property_editable_list_default_path(property);
+ const char *setting = obs_property_name(property);
+ OBSDataArrayAutoRelease array =
+ obs_data_get_array(view->settings, setting);
QString title = QTStr("Basic.PropertiesWindow.AddEditableListFiles")
.arg(QT_UTF8(desc));
@@ -2301,6 +2341,9 @@ void WidgetInfo::EditListAddFiles()
return;
list->addItems(files);
+ for (QString &file : files) {
+ EditableListArrayPushBack(array, QT_TO_UTF8(file));
+ }
EditableListChanged();
}
@@ -2310,6 +2353,9 @@ void WidgetInfo::EditListAddDir()
const char *desc = obs_property_description(property);
const char *default_path =
obs_property_editable_list_default_path(property);
+ const char *setting = obs_property_name(property);
+ OBSDataArrayAutoRelease array =
+ obs_data_get_array(view->settings, setting);
QString title = QTStr("Basic.PropertiesWindow.AddEditableListDir")
.arg(QT_UTF8(desc));
@@ -2325,6 +2371,7 @@ void WidgetInfo::EditListAddDir()
return;
list->addItem(dir);
+ EditableListArrayPushBack(array, QT_TO_UTF8(dir));
EditableListChanged();
}
@@ -2332,9 +2379,15 @@ void WidgetInfo::EditListRemove()
{
QListWidget *list = reinterpret_cast<QListWidget *>(widget);
QList<QListWidgetItem *> items = list->selectedItems();
+ const char *setting = obs_property_name(property);
+ OBSDataArrayAutoRelease array =
+ obs_data_get_array(view->settings, setting);
- for (QListWidgetItem *item : items)
+ for (qsizetype i = items.size() - 1; i >= 0; i--) {
+ QListWidgetItem *item = items.at(i);
+ obs_data_array_erase(array, list->row(item));
delete item;
+ }
EditableListChanged();
}
@@ -2343,6 +2396,7 @@ void WidgetInfo::EditListEdit()
QListWidget *list = reinterpret_cast<QListWidget *>(widget);
enum obs_editable_list_type type =
obs_property_editable_list_type(property);
+ const char *setting = obs_property_name(property);
const char *desc = obs_property_description(property);
const char *filter = obs_property_editable_list_filter(property);
QList<QListWidgetItem *> selectedItems = list->selectedItems();
@@ -2351,6 +2405,10 @@ void WidgetInfo::EditListEdit()
return;
QListWidgetItem *item = selectedItems[0];
+ int row = list->row(item);
+ OBSDataArrayAutoRelease array =
+ obs_data_get_array(view->settings, setting);
+ OBSDataAutoRelease arrayItem = obs_data_array_item(array, row);
if (type == OBS_EDITABLE_LIST_TYPE_FILES) {
QDir pathDir(item->text());
@@ -2367,6 +2425,7 @@ void WidgetInfo::EditListEdit()
return;
item->setText(path);
+ obs_data_set_string(arrayItem, "value", QT_TO_UTF8(path));
EditableListChanged();
return;
}
@@ -2385,6 +2444,7 @@ void WidgetInfo::EditListEdit()
return;
item->setText(text);
+ obs_data_set_string(arrayItem, "value", QT_TO_UTF8(text));
EditableListChanged();
}
@@ -2392,6 +2452,9 @@ void WidgetInfo::EditListUp()
{
QListWidget *list = reinterpret_cast<QListWidget *>(widget);
int lastItemRow = -1;
+ const char *setting = obs_property_name(property);
+ OBSDataArrayAutoRelease array =
+ obs_data_get_array(view->settings, setting);
for (int i = 0; i < list->count(); i++) {
QListWidgetItem *item = list->item(i);
@@ -2405,6 +2468,11 @@ void WidgetInfo::EditListUp()
list->takeItem(row);
list->insertItem(lastItemRow, item);
item->setSelected(true);
+
+ OBSDataAutoRelease arrayItem =
+ obs_data_array_item(array, row);
+ obs_data_array_insert(array, lastItemRow, arrayItem);
+ obs_data_array_erase(array, row + 1);
} else {
lastItemRow = row;
}
@@ -2417,6 +2485,9 @@ void WidgetInfo::EditListDown()
{
QListWidget *list = reinterpret_cast<QListWidget *>(widget);
int lastItemRow = list->count();
+ const char *setting = obs_property_name(property);
+ OBSDataArrayAutoRelease array =
+ obs_data_get_array(view->settings, setting);
for (int i = list->count() - 1; i >= 0; i--) {
QListWidgetItem *item = list->item(i);
@@ -2430,6 +2501,12 @@ void WidgetInfo::EditListDown()
list->takeItem(row);
list->insertItem(lastItemRow, item);
item->setSelected(true);
+
+ OBSDataAutoRelease arrayItem =
+ obs_data_array_item(array, row);
+ obs_data_array_insert(array, lastItemRow + 1,
+ arrayItem);
+ obs_data_array_erase(array, row);
} else {
lastItemRow = row;
}
diff --git a/UI/properties-view.hpp b/UI/properties-view.hpp
index e520dcdde2c90..89546b1317fba 100644
--- a/UI/properties-view.hpp
+++ b/UI/properties-view.hpp
@@ -47,6 +47,8 @@ class WidgetInfo : public QObject {
void ButtonClicked();
void TogglePasswordText(bool checked);
+ void EditableListArrayPushBack(obs_data_array_t *array,
+ const char *text);
public:
inline WidgetInfo(OBSPropertiesView *view_, obs_property_t *prop,
@@ -79,6 +81,10 @@ public slots:
void EditListEdit();
void EditListUp();
void EditListDown();
+ void EditListReordered(const QModelIndex &sourceParent, int sourceStart,
+ int sourceEnd,
+ const QModelIndex &destinationParent,
+ int destinationRow);
};
/* ------------------------------------------------------------------------- */

View File

@ -1,7 +1,7 @@
From 38031cd5d1e9486f06c782fbc0162e9f95e3d116 Mon Sep 17 00:00:00 2001
From: Bleuzen <12885163+Bleuzen@users.noreply.github.com>
Date: Sat, 19 Aug 2023 02:50:09 +0200
Subject: [PATCH] obs-ffmpeg: Add NVENC AV1 FFmpeg encoder, part 1
Subject: [PATCH 1/2] obs-ffmpeg: Add NVENC AV1 FFmpeg encoder, part 1
---
plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c | 109 ++++++++++++++++++++++++--
@ -23,7 +23,7 @@ index cfd4ea91916a2..80db3ba85ef39 100644
@@ -61,6 +62,13 @@ static const char *hevc_nvenc_getname(void *unused)
}
#endif
+#define ENCODER_NAME_AV1 "GPU: NVIDIA NVENC AV1 (FFmpeg)"
+static const char *av1_nvenc_getname(void *unused)
+{
@ -47,13 +47,13 @@ index cfd4ea91916a2..80db3ba85ef39 100644
&enc->header.array, &enc->header.num,
@@ -300,10 +310,11 @@ static void on_first_packet(void *data, AVPacket *pkt, struct darray *da)
}
static void *nvenc_create_internal(obs_data_t *settings, obs_encoder_t *encoder,
- bool psycho_aq, bool hevc)
+ bool psycho_aq, bool hevc, bool av1)
{
struct nvenc_encoder *enc = bzalloc(sizeof(*enc));
+ enc->av1 = av1;
#ifdef ENABLE_HEVC
enc->hevc = hevc;
@ -74,7 +74,7 @@ index cfd4ea91916a2..80db3ba85ef39 100644
ENCODER_NAME_H264, on_init_error,
@@ -368,12 +384,14 @@ static void *h264_nvenc_create(obs_data_t *settings, obs_encoder_t *encoder)
}
bool psycho_aq = obs_data_get_bool(settings, "psycho_aq");
- void *enc = nvenc_create_internal(settings, encoder, psycho_aq, false);
+ void *enc = nvenc_create_internal(settings, encoder, psycho_aq, false,
@ -87,11 +87,11 @@ index cfd4ea91916a2..80db3ba85ef39 100644
+ enc = nvenc_create_internal(settings, encoder, false, false,
+ false);
}
return enc;
@@ -415,18 +433,68 @@ static void *hevc_nvenc_create(obs_data_t *settings, obs_encoder_t *encoder)
}
bool psycho_aq = obs_data_get_bool(settings, "psycho_aq");
- void *enc = nvenc_create_internal(settings, encoder, psycho_aq, true);
+ void *enc = nvenc_create_internal(settings, encoder, psycho_aq, true,
@ -104,11 +104,11 @@ index cfd4ea91916a2..80db3ba85ef39 100644
+ enc = nvenc_create_internal(settings, encoder, false, true,
+ false);
}
return enc;
}
#endif
+static void *av1_nvenc_create(obs_data_t *settings, obs_encoder_t *encoder)
+{
+ video_t *video = obs_encoder_video(encoder);
@ -163,7 +163,7 @@ index cfd4ea91916a2..80db3ba85ef39 100644
@@ -669,6 +737,12 @@ obs_properties_t *hevc_nvenc_properties_ffmpeg(void *unused)
}
#endif
+obs_properties_t *av1_nvenc_properties_ffmpeg(void *unused)
+{
+ UNUSED_PARAMETER(unused);
@ -209,7 +209,7 @@ index 7eb9a876d82ff..07973ffc73b40 100644
+extern struct obs_encoder_info av1_nvenc_encoder_info;
extern struct obs_encoder_info svt_av1_encoder_info;
extern struct obs_encoder_info aom_av1_encoder_info;
@@ -272,7 +273,7 @@ static void do_nvenc_check_for_ubuntu_20_04(void)
static bool nvenc_codec_exists(const char *name, const char *fallback)
{
@ -217,7 +217,7 @@ index 7eb9a876d82ff..07973ffc73b40 100644
- if (!nvenc)
+ if (!nvenc && fallback)
nvenc = avcodec_find_encoder_by_name(fallback);
return nvenc != NULL;
@@ -302,8 +303,10 @@ static bool nvenc_supported(bool *out_h264, bool *out_hevc, bool *out_av1)
if (success) {
@ -238,5 +238,38 @@ index 7eb9a876d82ff..07973ffc73b40 100644
+ if (av1)
+ obs_register_encoder(&av1_nvenc_encoder_info);
}
#ifdef _WIN32
From c973af782104d8ac471e08da6b243ceac102f6f2 Mon Sep 17 00:00:00 2001
From: Bleuzen <12885163+Bleuzen@users.noreply.github.com>
Date: Mon, 13 Nov 2023 00:02:14 +0100
Subject: [PATCH 2/2] obs-ffmpeg: Add NVENC AV1 FFmpeg encoder, part 2
---
plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c b/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c
index 80db3ba85ef39..72455e23b744f 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c
@@ -19,6 +19,7 @@
#ifdef ENABLE_HEVC
#include <obs-hevc.h>
#endif
+#include <obs-av1.h>
#include "obs-ffmpeg-video-encoders.h"
@@ -290,7 +291,9 @@ static void on_first_packet(void *data, AVPacket *pkt, struct darray *da)
} else
#endif
if (enc->av1) {
- // TODO: add obs_extract_av1_headers
+ obs_extract_av1_headers(pkt->data, pkt->size,
+ (uint8_t **)&da->array, &da->num,
+ &enc->header.array, &enc->header.num);
} else {
obs_extract_avc_headers(pkt->data, pkt->size,
(uint8_t **)&da->array, &da->num,

View File

@ -1,218 +1,7 @@
From a8d13ad4d98e70da648819afc219c65d256cf95d Mon Sep 17 00:00:00 2001
From: David Rosca <nowrep@gmail.com>
Date: Tue, 2 May 2023 13:14:18 +0200
Subject: [PATCH 1/3] libobs: Add AV1 parsing functions
---
libobs/CMakeLists.txt | 2 +
libobs/cmake/legacy.cmake | 2 +
libobs/obs-av1.c | 123 ++++++++++++++++++++++++++++++++++++++
libobs/obs-av1.h | 35 +++++++++++
4 files changed, 162 insertions(+)
create mode 100644 libobs/obs-av1.c
create mode 100644 libobs/obs-av1.h
diff --git a/libobs/CMakeLists.txt b/libobs/CMakeLists.txt
index 46112abe71f9d..36a75713c001f 100644
--- a/libobs/CMakeLists.txt
+++ b/libobs/CMakeLists.txt
@@ -33,6 +33,8 @@ target_sources(
obs-audio-controls.c
obs-audio-controls.h
obs-audio.c
+ obs-av1.c
+ obs-av1.h
obs-avc.c
obs-avc.h
obs-data.c
diff --git a/libobs/cmake/legacy.cmake b/libobs/cmake/legacy.cmake
index 5f13c4c0f04ab..dd77cdfb94229 100644
--- a/libobs/cmake/legacy.cmake
+++ b/libobs/cmake/legacy.cmake
@@ -32,6 +32,8 @@ target_sources(
obs-audio.c
obs-audio-controls.c
obs-audio-controls.h
+ obs-av1.c
+ obs-av1.h
obs-avc.c
obs-avc.h
obs-data.c
diff --git a/libobs/obs-av1.c b/libobs/obs-av1.c
new file mode 100644
index 0000000000000..a015130537cf2
--- /dev/null
+++ b/libobs/obs-av1.c
@@ -0,0 +1,123 @@
+// SPDX-FileCopyrightText: 2023 David Rosca <nowrep@gmail.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "obs-av1.h"
+
+#include "obs.h"
+
+static inline uint64_t leb128(const uint8_t *buf, size_t size, size_t *len)
+{
+ uint64_t value = 0;
+ uint8_t leb128_byte;
+
+ *len = 0;
+
+ for (int i = 0; i < 8; i++) {
+ if (size-- < 1)
+ break;
+ (*len)++;
+ leb128_byte = buf[i];
+ value |= (leb128_byte & 0x7f) << (i * 7);
+ if (!(leb128_byte & 0x80))
+ break;
+ }
+
+ return value;
+}
+
+static inline unsigned int get_bits(uint8_t val, unsigned int n,
+ unsigned int count)
+{
+ return (val >> (8 - n - count)) & ((1 << (count - 1)) * 2 - 1);
+}
+
+static void parse_obu_header(const uint8_t *buf, size_t size, size_t *obu_start,
+ size_t *obu_size, int *obu_type)
+{
+ int extension_flag, has_size_field;
+ size_t size_len = 0;
+
+ *obu_start = 0;
+ *obu_size = 0;
+ *obu_type = 0;
+
+ if (size < 1)
+ return;
+
+ *obu_type = get_bits(*buf, 1, 4);
+ extension_flag = get_bits(*buf, 5, 1);
+ has_size_field = get_bits(*buf, 6, 1);
+
+ if (extension_flag)
+ (*obu_start)++;
+
+ (*obu_start)++;
+
+ if (has_size_field)
+ *obu_size = (size_t)leb128(buf + *obu_start, size - *obu_start,
+ &size_len);
+ else
+ *obu_size = size - 1;
+
+ *obu_start += size_len;
+}
+
+bool obs_av1_keyframe(const uint8_t *data, size_t size)
+{
+ const uint8_t *start = data, *end = data + size;
+
+ while (start < end) {
+ size_t obu_start, obu_size;
+ int obu_type;
+ parse_obu_header(start, end - start, &obu_start, &obu_size,
+ &obu_type);
+
+ if (obu_size) {
+ if (obu_type == OBS_OBU_FRAME ||
+ obu_type == OBS_OBU_FRAME_HEADER) {
+ uint8_t val = *(start + obu_start);
+ if (!get_bits(val, 0, 1)) // show_existing_frame
+ return get_bits(val, 1, 2) ==
+ 0; // frame_type
+ return false;
+ }
+ }
+
+ start += obu_start + obu_size;
+ }
+
+ return false;
+}
+
+void obs_extract_av1_headers(const uint8_t *packet, size_t size,
+ uint8_t **new_packet_data, size_t *new_packet_size,
+ uint8_t **header_data, size_t *header_size)
+{
+ DARRAY(uint8_t) new_packet;
+ DARRAY(uint8_t) header;
+ const uint8_t *start = packet, *end = packet + size;
+
+ da_init(new_packet);
+ da_init(header);
+
+ while (start < end) {
+ size_t obu_start, obu_size;
+ int obu_type;
+ parse_obu_header(start, end - start, &obu_start, &obu_size,
+ &obu_type);
+
+ if (obu_type == OBS_OBU_METADATA ||
+ obu_type == OBS_OBU_SEQUENCE_HEADER) {
+ da_push_back_array(header, start, obu_start + obu_size);
+ }
+ da_push_back_array(new_packet, start, obu_start + obu_size);
+
+ start += obu_start + obu_size;
+ }
+
+ *new_packet_data = new_packet.array;
+ *new_packet_size = new_packet.num;
+ *header_data = header.array;
+ *header_size = header.num;
+}
diff --git a/libobs/obs-av1.h b/libobs/obs-av1.h
new file mode 100644
index 0000000000000..031299da0a415
--- /dev/null
+++ b/libobs/obs-av1.h
@@ -0,0 +1,35 @@
+// SPDX-FileCopyrightText: 2023 David Rosca <nowrep@gmail.com>
+//
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "util/c99defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ OBS_OBU_SEQUENCE_HEADER = 1,
+ OBS_OBU_TEMPORAL_DELIMITER = 2,
+ OBS_OBU_FRAME_HEADER = 3,
+ OBS_OBU_TILE_GROUP = 4,
+ OBS_OBU_METADATA = 5,
+ OBS_OBU_FRAME = 6,
+ OBS_OBU_REDUNDANT_FRAME_HEADER = 7,
+ OBS_OBU_TILE_LIST = 8,
+ OBS_OBU_PADDING = 15,
+};
+
+/* Helpers for parsing AV1 OB units. */
+
+EXPORT bool obs_av1_keyframe(const uint8_t *data, size_t size);
+EXPORT void obs_extract_av1_headers(const uint8_t *packet, size_t size,
+ uint8_t **new_packet_data,
+ size_t *new_packet_size,
+ uint8_t **header_data, size_t *header_size);
+
+#ifdef __cplusplus
+}
+#endif
From 5d0940dd512515d7885aafdd01cff6a875431418 Mon Sep 17 00:00:00 2001
From 27565d8ffc8fa7407381595f56c2f1aebb03d3ec Mon Sep 17 00:00:00 2001
From: David Rosca <nowrep@gmail.com>
Date: Tue, 2 May 2023 13:39:13 +0200
Subject: [PATCH 2/3] obs-ffmpeg: Add AV1 support for VA-API
Subject: [PATCH 1/2] obs-ffmpeg: Add AV1 support for VA-API
---
plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c | 284 ++++++++++++++++----------
@ -222,7 +11,7 @@ Subject: [PATCH 2/3] obs-ffmpeg: Add AV1 support for VA-API
4 files changed, 254 insertions(+), 108 deletions(-)
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
index 25c5f79007a31..7543d68b6f750 100644
index ec2a8651a850b..88c906e5dc98d 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
@@ -24,6 +24,7 @@
@ -236,7 +25,7 @@ index 25c5f79007a31..7543d68b6f750 100644
@@ -51,8 +52,15 @@
#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__)
#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__)
+enum codec_type {
+ CODEC_H264,
+ CODEC_HEVC,
@ -246,13 +35,13 @@ index 25c5f79007a31..7543d68b6f750 100644
struct vaapi_encoder {
obs_encoder_t *encoder;
+ enum codec_type codec;
AVBufferRef *vadevice_ref;
AVBufferRef *vaframes_ref;
@@ -83,59 +91,48 @@ static const char *h264_vaapi_getname(void *unused)
return "FFmpeg VAAPI H.264";
}
-#ifdef ENABLE_HEVC
-static const char *hevc_vaapi_getname(void *unused)
+static const char *av1_vaapi_getname(void *unused)
@ -267,7 +56,7 @@ index 25c5f79007a31..7543d68b6f750 100644
- return format == VIDEO_FORMAT_NV12;
+ return "FFmpeg VAAPI AV1";
}
#ifdef ENABLE_HEVC
-static inline bool hevc_valid_format(enum video_format format)
+static const char *hevc_vaapi_getname(void *unused)
@ -277,7 +66,7 @@ index 25c5f79007a31..7543d68b6f750 100644
+ return "FFmpeg VAAPI HEVC";
}
#endif
-static void h264_vaapi_video_info(void *data, struct video_scale_info *info)
+static inline bool vaapi_valid_format(struct vaapi_encoder *enc,
+ enum video_format format)
@ -302,16 +91,16 @@ index 25c5f79007a31..7543d68b6f750 100644
-
- info->format = pref_format;
}
-#ifdef ENABLE_HEVC
-static void hevc_vaapi_video_info(void *data, struct video_scale_info *info)
+static void vaapi_video_info(void *data, struct video_scale_info *info)
{
struct vaapi_encoder *enc = data;
enum video_format pref_format;
pref_format = obs_encoder_get_preferred_video_format(enc->encoder);
- if (!hevc_valid_format(pref_format)) {
- pref_format = hevc_valid_format(info->format)
+ if (!vaapi_valid_format(enc, pref_format)) {
@ -319,34 +108,34 @@ index 25c5f79007a31..7543d68b6f750 100644
? info->format
: VIDEO_FORMAT_NV12;
}
info->format = pref_format;
}
-#endif
static bool vaapi_init_codec(struct vaapi_encoder *enc, const char *path)
{
@@ -232,7 +229,7 @@ static const rc_mode_t *get_rc_mode(const char *name)
return rc_mode ? rc_mode : RC_MODES;
}
-static bool vaapi_update(void *data, obs_data_t *settings, bool hevc)
+static bool vaapi_update(void *data, obs_data_t *settings)
{
struct vaapi_encoder *enc = data;
@@ -247,7 +244,7 @@ static bool vaapi_update(void *data, obs_data_t *settings, bool hevc)
int bf = (int)obs_data_get_int(settings, "bf");
int qp = rc_mode->qp ? (int)obs_data_get_int(settings, "qp") : 0;
- av_opt_set_int(enc->context->priv_data, "qp", qp, 0);
+ enc->context->global_quality = enc->codec == CODEC_AV1 ? qp * 5 : qp;
int level = (int)obs_data_get_int(settings, "level");
int bitrate = rc_mode->bitrate
@@ -277,21 +274,15 @@ static bool vaapi_update(void *data, obs_data_t *settings, bool hevc)
info.range = voi->range;
#ifdef ENABLE_HEVC
- if (hevc) {
+ if (enc->codec == CODEC_HEVC) {
@ -366,13 +155,13 @@ index 25c5f79007a31..7543d68b6f750 100644
}
+#endif
+ vaapi_video_info(enc, &info);
enc->context->profile = profile;
enc->context->max_b_frames = bf;
@@ -418,16 +409,28 @@ static void vaapi_destroy(void *data)
@@ -414,8 +405,20 @@ static void vaapi_destroy(void *data)
bfree(enc);
}
+static inline const char *vaapi_encoder_name(enum codec_type codec)
+{
+ if (codec == CODEC_H264) {
@ -390,28 +179,29 @@ index 25c5f79007a31..7543d68b6f750 100644
+ enum codec_type codec)
{
struct vaapi_encoder *enc;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100)
@@ -425,8 +428,8 @@ static void *vaapi_create_internal(obs_data_t *settings, obs_encoder_t *encoder,
enc = bzalloc(sizeof(*enc));
enc->encoder = encoder;
- const char *const name = hevc ? "hevc_vaapi" : "h264_vaapi";
- enc->vaapi = avcodec_find_encoder_by_name(name);
+ enc->codec = codec;
+ enc->vaapi = avcodec_find_encoder_by_name(vaapi_encoder_name(codec));
enc->first_packet = true;
@@ -444,7 +447,7 @@ static void *vaapi_create_internal(obs_data_t *settings, obs_encoder_t *encoder,
goto fail;
}
- if (!vaapi_update(enc, settings, hevc))
+ if (!vaapi_update(enc, settings))
goto fail;
return enc;
@@ -456,13 +459,18 @@ static void *vaapi_create_internal(obs_data_t *settings, obs_encoder_t *encoder,
static void *h264_vaapi_create(obs_data_t *settings, obs_encoder_t *encoder)
{
- return vaapi_create_internal(settings, encoder, false);
@ -422,7 +212,7 @@ index 25c5f79007a31..7543d68b6f750 100644
+{
+ return vaapi_create_internal(settings, encoder, CODEC_AV1);
}
#ifdef ENABLE_HEVC
static void *hevc_vaapi_create(obs_data_t *settings, obs_encoder_t *encoder)
{
@ -430,11 +220,11 @@ index 25c5f79007a31..7543d68b6f750 100644
+ return vaapi_create_internal(settings, encoder, CODEC_HEVC);
}
#endif
@@ -492,9 +500,8 @@ static inline void copy_data(AVFrame *pic, const struct encoder_frame *frame,
}
}
-static bool vaapi_encode_internal(void *data, struct encoder_frame *frame,
- struct encoder_packet *packet,
- bool *received_packet, bool hevc)
@ -444,7 +234,7 @@ index 25c5f79007a31..7543d68b6f750 100644
struct vaapi_encoder *enc = data;
AVFrame *hwframe = NULL;
@@ -556,22 +563,26 @@ static bool vaapi_encode_internal(void *data, struct encoder_frame *frame,
enc->first_packet = false;
#ifdef ENABLE_HEVC
- if (hevc) {
@ -472,7 +262,7 @@ index 25c5f79007a31..7543d68b6f750 100644
+ &enc->header,
+ &enc->header_size);
}
da_copy_array(enc->buffer, new_packet, size);
@@ -587,14 +598,17 @@ static bool vaapi_encode_internal(void *data, struct encoder_frame *frame,
packet->size = enc->buffer.num;
@ -497,7 +287,7 @@ index 25c5f79007a31..7543d68b6f750 100644
@@ -610,54 +624,61 @@ static bool vaapi_encode_internal(void *data, struct encoder_frame *frame,
return false;
}
-static bool h264_vaapi_encode(void *data, struct encoder_frame *frame,
- struct encoder_packet *packet,
- bool *received_packet)
@ -508,7 +298,7 @@ index 25c5f79007a31..7543d68b6f750 100644
+ obs_property_t *p = obs_properties_get(ppts, name);
+ obs_property_set_visible(p, visible);
}
-#ifdef ENABLE_HEVC
-static bool hevc_vaapi_encode(void *data, struct encoder_frame *frame,
- struct encoder_packet *packet,
@ -534,7 +324,7 @@ index 25c5f79007a31..7543d68b6f750 100644
+ }
+ return VAProfileNone;
}
-static void vaapi_defaults_internal(obs_data_t *settings, bool hevc)
+static inline const char *vaapi_default_device(enum codec_type codec)
{
@ -554,7 +344,7 @@ index 25c5f79007a31..7543d68b6f750 100644
+ }
+ return NULL;
+}
+static void vaapi_defaults_internal(obs_data_t *settings, enum codec_type codec)
+{
+ const char *const device = vaapi_default_device(codec);
@ -565,7 +355,7 @@ index 25c5f79007a31..7543d68b6f750 100644
obs_data_set_default_int(settings, "profile",
FF_PROFILE_HEVC_MAIN);
+ obs_data_set_default_int(settings, "level", 120);
} else
-#else
- UNUSED_PARAMETER(hevc);
@ -587,7 +377,7 @@ index 25c5f79007a31..7543d68b6f750 100644
@@ -670,12 +691,7 @@ static void vaapi_defaults_internal(obs_data_t *settings, bool hevc)
if (!va_dpy)
return;
-#ifdef ENABLE_HEVC
- const VAProfile profile = hevc ? VAProfileHEVCMain
- : VAProfileH264ConstrainedBaseline;
@ -599,7 +389,7 @@ index 25c5f79007a31..7543d68b6f750 100644
obs_data_set_default_string(settings, "rate_control", "CBR");
else if (vaapi_device_rc_supported(profile, va_dpy, VA_RC_VBR, device))
@@ -688,12 +704,17 @@ static void vaapi_defaults_internal(obs_data_t *settings, bool hevc)
static void h264_vaapi_defaults(obs_data_t *settings)
{
- vaapi_defaults_internal(settings, false);
@ -610,13 +400,13 @@ index 25c5f79007a31..7543d68b6f750 100644
+{
+ vaapi_defaults_internal(settings, CODEC_AV1);
}
static void hevc_vaapi_defaults(obs_data_t *settings)
{
- vaapi_defaults_internal(settings, true);
+ vaapi_defaults_internal(settings, CODEC_HEVC);
}
static bool vaapi_device_modified(obs_properties_t *ppts, obs_property_t *p,
@@ -729,6 +750,11 @@ static bool vaapi_device_modified(obs_properties_t *ppts, obs_property_t *p,
goto fail;
@ -630,16 +420,16 @@ index 25c5f79007a31..7543d68b6f750 100644
#ifdef ENABLE_HEVC
case FF_PROFILE_HEVC_MAIN:
if (!vaapi_display_hevc_supported(va_dpy, device))
@@ -800,7 +826,7 @@ static bool get_device_name_from_pci(struct pci_access *pacc, char *pci_slot,
@@ -802,7 +828,7 @@ static bool get_device_name_from_pci(struct pci_access *pacc, char *pci_slot,
return false;
}
-static obs_properties_t *vaapi_properties_internal(bool hevc)
+static obs_properties_t *vaapi_properties_internal(enum codec_type codec)
{
obs_properties_t *props = obs_properties_create();
obs_property_t *list;
@@ -891,16 +917,18 @@ static obs_properties_t *vaapi_properties_internal(bool hevc)
@@ -893,16 +919,18 @@ static obs_properties_t *vaapi_properties_internal(bool hevc)
obs_module_text("Profile"),
OBS_COMBO_TYPE_LIST,
OBS_COMBO_FORMAT_INT);
@ -658,9 +448,9 @@ index 25c5f79007a31..7543d68b6f750 100644
+ } else if (codec == CODEC_AV1) {
+ obs_property_list_add_int(list, "Main", FF_PROFILE_AV1_MAIN);
}
obs_property_set_modified_callback(list, vaapi_device_modified);
@@ -909,15 +937,34 @@ static obs_properties_t *vaapi_properties_internal(bool hevc)
@@ -911,15 +939,34 @@ static obs_properties_t *vaapi_properties_internal(bool hevc)
OBS_COMBO_TYPE_LIST,
OBS_COMBO_FORMAT_INT);
obs_property_list_add_int(list, "Auto", FF_LEVEL_UNKNOWN);
@ -701,10 +491,10 @@ index 25c5f79007a31..7543d68b6f750 100644
+ obs_property_list_add_int(list, "5.2", 14);
+ obs_property_list_add_int(list, "5.3", 15);
+ }
list = obs_properties_add_list(props, "rate_control",
obs_module_text("RateControl"),
@@ -952,14 +999,20 @@ static obs_properties_t *vaapi_properties_internal(bool hevc)
@@ -957,14 +1004,20 @@ static obs_properties_t *vaapi_properties_internal(bool hevc)
static obs_properties_t *h264_vaapi_properties(void *unused)
{
UNUSED_PARAMETER(unused);
@ -717,7 +507,7 @@ index 25c5f79007a31..7543d68b6f750 100644
+ UNUSED_PARAMETER(unused);
+ return vaapi_properties_internal(CODEC_AV1);
}
#ifdef ENABLE_HEVC
static obs_properties_t *hevc_vaapi_properties(void *unused)
{
@ -726,8 +516,8 @@ index 25c5f79007a31..7543d68b6f750 100644
+ return vaapi_properties_internal(CODEC_HEVC);
}
#endif
@@ -988,12 +1041,27 @@ struct obs_encoder_info h264_vaapi_encoder_info = {
@@ -993,12 +1046,27 @@ struct obs_encoder_info h264_vaapi_encoder_info = {
.get_name = h264_vaapi_getname,
.create = h264_vaapi_create,
.destroy = vaapi_destroy,
@ -755,9 +545,9 @@ index 25c5f79007a31..7543d68b6f750 100644
+ .get_sei_data = vaapi_sei_data,
+ .get_video_info = vaapi_video_info,
};
#ifdef ENABLE_HEVC
@@ -1004,11 +1072,11 @@ struct obs_encoder_info hevc_vaapi_encoder_info = {
@@ -1009,11 +1077,11 @@ struct obs_encoder_info hevc_vaapi_encoder_info = {
.get_name = hevc_vaapi_getname,
.create = hevc_vaapi_create,
.destroy = vaapi_destroy,
@ -776,7 +566,7 @@ index 7eb9a876d82ff..981bb9c6550ff 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg.c
@@ -47,6 +47,7 @@ extern struct obs_encoder_info aom_av1_encoder_info;
#ifdef LIBAVUTIL_VAAPI_AVAILABLE
extern struct obs_encoder_info h264_vaapi_encoder_info;
+extern struct obs_encoder_info av1_vaapi_encoder_info;
@ -804,7 +594,7 @@ index 7eb9a876d82ff..981bb9c6550ff 100644
@@ -447,6 +459,13 @@ bool obs_module_load(void)
blog(LOG_INFO, "FFmpeg VAAPI H264 encoding not supported");
}
+ if (av1_vaapi_supported()) {
+ blog(LOG_INFO, "FFmpeg VAAPI AV1 encoding supported");
+ obs_register_encoder(&av1_vaapi_encoder_info);
@ -816,13 +606,13 @@ index 7eb9a876d82ff..981bb9c6550ff 100644
if (hevc_vaapi_supported()) {
blog(LOG_INFO, "FFmpeg VAAPI HEVC encoding supported");
diff --git a/plugins/obs-ffmpeg/vaapi-utils.c b/plugins/obs-ffmpeg/vaapi-utils.c
index 4198ee59c6ab4..2c8eddd3676fa 100644
index d020e2a1d8704..2ca7e468cc485 100644
--- a/plugins/obs-ffmpeg/vaapi-utils.c
+++ b/plugins/obs-ffmpeg/vaapi-utils.c
@@ -261,6 +261,61 @@ const char *vaapi_get_h264_default_device()
@@ -293,6 +293,61 @@ const char *vaapi_get_h264_default_device()
return default_h264_device;
}
+bool vaapi_display_av1_supported(VADisplay dpy, const char *device_path)
+{
+ bool ret = false;
@ -879,16 +669,16 @@ index 4198ee59c6ab4..2c8eddd3676fa 100644
+}
+
#ifdef ENABLE_HEVC
bool vaapi_display_hevc_supported(VADisplay dpy, const char *device_path)
diff --git a/plugins/obs-ffmpeg/vaapi-utils.h b/plugins/obs-ffmpeg/vaapi-utils.h
index b90b2394710b3..2d7ee29dc9ab9 100644
index b8a8800331266..d458bad2c5d82 100644
--- a/plugins/obs-ffmpeg/vaapi-utils.h
+++ b/plugins/obs-ffmpeg/vaapi-utils.h
@@ -19,6 +19,10 @@ bool vaapi_display_h264_supported(VADisplay dpy, const char *device_path);
@@ -20,6 +20,10 @@ bool vaapi_display_h264_supported(VADisplay dpy, const char *device_path);
bool vaapi_device_h264_supported(const char *device_path);
const char *vaapi_get_h264_default_device(void);
+bool vaapi_display_av1_supported(VADisplay dpy, const char *device_path);
+bool vaapi_device_av1_supported(const char *device_path);
+const char *vaapi_get_av1_default_device(void);
@ -897,10 +687,10 @@ index b90b2394710b3..2d7ee29dc9ab9 100644
bool vaapi_display_hevc_supported(VADisplay dpy, const char *device_path);
bool vaapi_device_hevc_supported(const char *device_path);
From 1b2b4da94760c829366e129cddda7cfe886f7b48 Mon Sep 17 00:00:00 2001
From 871212adda660968cff324e1ab1053e19b342c11 Mon Sep 17 00:00:00 2001
From: David Rosca <nowrep@gmail.com>
Date: Fri, 22 Sep 2023 08:11:46 +0200
Subject: [PATCH 3/3] obs-ffmpeg: Set better VA-API defaults
Subject: [PATCH 2/2] 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.
@ -909,7 +699,7 @@ Remove setting default value for unused "rendermode" option.
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
index 7543d68b6f750..0ec7fa2ec43d0 100644
index 88c906e5dc98d..b7e5d5eddb4a0 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
@@ -663,26 +663,21 @@ static void vaapi_defaults_internal(obs_data_t *settings, enum codec_type codec)
@ -944,17 +734,17 @@ index 7543d68b6f750..0ec7fa2ec43d0 100644
- obs_data_set_default_int(settings, "rendermode", 0);
obs_data_set_default_int(settings, "qp", 20);
obs_data_set_default_int(settings, "maxrate", 0);
@@ -770,7 +765,7 @@ static bool vaapi_device_modified(obs_properties_t *ppts, obs_property_t *p,
}
if (vaapi_device_rc_supported(profile, va_dpy, VA_RC_CBR, device))
- obs_property_list_add_string(rc_p, "CBR (default)", "CBR");
+ obs_property_list_add_string(rc_p, "CBR", "CBR");
if (vaapi_device_rc_supported(profile, va_dpy, VA_RC_VBR, device))
obs_property_list_add_string(rc_p, "VBR", "VBR");
@@ -922,8 +917,7 @@ static obs_properties_t *vaapi_properties_internal(enum codec_type codec)
@@ -924,8 +919,7 @@ static obs_properties_t *vaapi_properties_internal(enum codec_type codec)
obs_property_list_add_int(list, "Main10",
FF_PROFILE_HEVC_MAIN_10);
} else if (codec == CODEC_H264) {
@ -964,7 +754,7 @@ index 7543d68b6f750..0ec7fa2ec43d0 100644
FF_PROFILE_H264_CONSTRAINED_BASELINE);
obs_property_list_add_int(list, "Main", FF_PROFILE_H264_MAIN);
obs_property_list_add_int(list, "High", FF_PROFILE_H264_HIGH);
@@ -940,8 +934,7 @@ static obs_properties_t *vaapi_properties_internal(enum codec_type codec)
@@ -942,8 +936,7 @@ static obs_properties_t *vaapi_properties_internal(enum codec_type codec)
if (codec == CODEC_H264) {
obs_property_list_add_int(list, "3.0", 30);
obs_property_list_add_int(list, "3.1", 31);
@ -974,7 +764,7 @@ index 7543d68b6f750..0ec7fa2ec43d0 100644
obs_property_list_add_int(list, "4.1", 41);
obs_property_list_add_int(list, "4.2", 42);
obs_property_list_add_int(list, "5.0", 50);
@@ -950,7 +943,7 @@ static obs_properties_t *vaapi_properties_internal(enum codec_type codec)
@@ -952,7 +945,7 @@ static obs_properties_t *vaapi_properties_internal(enum codec_type codec)
} else if (codec == CODEC_HEVC) {
obs_property_list_add_int(list, "3.0", 90);
obs_property_list_add_int(list, "3.1", 93);
@ -983,7 +773,7 @@ index 7543d68b6f750..0ec7fa2ec43d0 100644
obs_property_list_add_int(list, "4.1", 123);
obs_property_list_add_int(list, "5.0", 150);
obs_property_list_add_int(list, "5.1", 153);
@@ -958,7 +951,7 @@ static obs_properties_t *vaapi_properties_internal(enum codec_type codec)
@@ -960,7 +953,7 @@ static obs_properties_t *vaapi_properties_internal(enum codec_type codec)
} else if (codec == CODEC_AV1) {
obs_property_list_add_int(list, "3.0", 4);
obs_property_list_add_int(list, "3.1", 5);

14
patches/add-plugins.patch Normal file
View File

@ -0,0 +1,14 @@
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index d20bce142..febeff6b7 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -60,6 +60,9 @@ elseif(OS_LINUX)
add_subdirectory(vlc-video)
add_subdirectory(sndio)
add_subdirectory(obs-vst)
+ add_subdirectory(obs-source-record)
+
+
check_obs_browser()
elseif(OS_FREEBSD)

View File

@ -4,34 +4,11 @@ Date: Sat, 29 Apr 2023 14:46:16 -0600
Subject: [PATCH] encoder rename
---
plugins/obs-ffmpeg/jim-nvenc.c | 4 ++--
plugins/obs-ffmpeg/obs-ffmpeg-av1.c | 4 ++--
plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c | 4 ++--
plugins/obs-ffmpeg/texture-amf.cpp | 6 +++---
plugins/obs-x264/obs-x264.c | 2 +-
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/plugins/obs-ffmpeg/jim-nvenc.c b/plugins/obs-ffmpeg/jim-nvenc.c
index 10a7dd1..c912205 100644
--- a/plugins/obs-ffmpeg/jim-nvenc.c
+++ b/plugins/obs-ffmpeg/jim-nvenc.c
@@ -227,14 +227,14 @@ static void nv_texture_free(struct nvenc_data *enc, struct nv_texture *nvtex)
static const char *h264_nvenc_get_name(void *type_data)
{
UNUSED_PARAMETER(type_data);
- return "NVIDIA NVENC H.264";
+ return "GPU: NVIDIA NVENC H.264 (FFmpeg)";
}
#ifdef ENABLE_HEVC
static const char *hevc_nvenc_get_name(void *type_data)
{
UNUSED_PARAMETER(type_data);
- return "NVIDIA NVENC HEVC";
+ return "GPU: NVIDIA NVENC H.265/HEVC (FFmpeg)";
}
#endif
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-av1.c b/plugins/obs-ffmpeg/obs-ffmpeg-av1.c
index 0b671ae..681f728 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-av1.c
@ -74,37 +51,6 @@ index 8cd8138..add8e02 100644
static const char *hevc_nvenc_getname(void *unused)
{
UNUSED_PARAMETER(unused);
diff --git a/plugins/obs-ffmpeg/texture-amf.cpp b/plugins/obs-ffmpeg/texture-amf.cpp
index 0f5ee7b..e350257 100644
--- a/plugins/obs-ffmpeg/texture-amf.cpp
+++ b/plugins/obs-ffmpeg/texture-amf.cpp
@@ -2101,7 +2101,7 @@ static obs_properties_t *amf_av1_properties(void *unused)
static const char *amf_avc_get_name(void *)
{
- return "AMD HW H.264 (AVC)";
+ return "GPU: AMD AMF H.264 (FFmpeg)";
}
static inline int get_avc_preset(amf_base *enc, const char *preset)
@@ -2443,7 +2443,7 @@ static void register_avc()
static const char *amf_hevc_get_name(void *)
{
- return "AMD HW H.265 (HEVC)";
+ return "GPU: AMD AMF H.265/HEVC (FFmpeg)";
}
static inline int get_hevc_preset(amf_base *enc, const char *preset)
@@ -2788,7 +2788,7 @@ static void register_hevc()
static const char *amf_av1_get_name(void *)
{
- return "AMD HW AV1";
+ return "GPU: AMD AMF AV1 (FFmpeg)";
}
static inline int get_av1_preset(amf_base *enc, const char *preset)
diff --git a/plugins/obs-x264/obs-x264.c b/plugins/obs-x264/obs-x264.c
index 1de88d3..d4c377d 100644
--- a/plugins/obs-x264/obs-x264.c

View File

@ -0,0 +1,423 @@
From 09fbac02fa36e945480edb1cf8547ba8ce4d08ff Mon Sep 17 00:00:00 2001
From: Neal Gompa <neal@gompa.dev>
Date: Mon, 11 Sep 2023 15:50:55 -0400
Subject: [PATCH] cmake: Allow CMake 3.20 and 3.21 to be used to build OBS
CentOS Stream 9 (and thus Red Hat Enterprise Linux 9) have CMake 3.20.
There does not appear to be anything preventing it from building
on CMake 3.20, so let's permit it so that it can still be built
for Fedora Extra Packages for Enterprise Linux 9.
---
CMakeLists.txt | 2 +-
UI/CMakeLists.txt | 2 +-
UI/frontend-plugins/aja-output-ui/CMakeLists.txt | 2 +-
UI/frontend-plugins/decklink-captions/CMakeLists.txt | 2 +-
UI/frontend-plugins/decklink-output-ui/CMakeLists.txt | 2 +-
UI/frontend-plugins/frontend-tools/CMakeLists.txt | 2 +-
UI/obs-frontend-api/CMakeLists.txt | 2 +-
deps/blake2/CMakeLists.txt | 2 +-
deps/file-updater/CMakeLists.txt | 2 +-
deps/glad/CMakeLists.txt | 2 +-
deps/happy-eyeballs/CMakeLists.txt | 2 +-
deps/json11/CMakeLists.txt | 2 +-
deps/libcaption/CMakeLists.txt | 2 +-
deps/media-playback/CMakeLists.txt | 2 +-
deps/obs-scripting/CMakeLists.txt | 2 +-
deps/obs-scripting/obslua/CMakeLists.txt | 2 +-
deps/obs-scripting/obspython/CMakeLists.txt | 2 +-
deps/opts-parser/CMakeLists.txt | 2 +-
deps/uthash/CMakeLists.txt | 2 +-
libobs-opengl/CMakeLists.txt | 2 +-
libobs/CMakeLists.txt | 2 +-
plugins/CMakeLists.txt | 2 +-
plugins/aja/CMakeLists.txt | 2 +-
plugins/decklink/CMakeLists.txt | 2 +-
plugins/image-source/CMakeLists.txt | 2 +-
plugins/obs-ffmpeg/CMakeLists.txt | 2 +-
plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt | 2 +-
plugins/obs-filters/CMakeLists.txt | 2 +-
plugins/obs-outputs/CMakeLists.txt | 2 +-
plugins/obs-qsv11/CMakeLists.txt | 2 +-
plugins/obs-transitions/CMakeLists.txt | 2 +-
plugins/obs-vst/CMakeLists.txt | 2 +-
plugins/obs-webrtc/CMakeLists.txt | 2 +-
plugins/obs-x264/CMakeLists.txt | 2 +-
plugins/rtmp-services/CMakeLists.txt | 2 +-
plugins/text-freetype2/CMakeLists.txt | 2 +-
plugins/vlc-video/CMakeLists.txt | 2 +-
37 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b6f157fbe..3e628c792 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
if(CMAKE_HOST_SYSTEM_NAME MATCHES "(Darwin)" OR OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0)
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/common/bootstrap.cmake" NO_POLICY_SCOPE)
diff --git a/UI/CMakeLists.txt b/UI/CMakeLists.txt
index cbebcd84d..b5660e662 100644
--- a/UI/CMakeLists.txt
+++ b/UI/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/UI/frontend-plugins/aja-output-ui/CMakeLists.txt b/UI/frontend-plugins/aja-output-ui/CMakeLists.txt
index 3555192e6..e9b9ed0ba 100644
--- a/UI/frontend-plugins/aja-output-ui/CMakeLists.txt
+++ b/UI/frontend-plugins/aja-output-ui/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/UI/frontend-plugins/decklink-captions/CMakeLists.txt b/UI/frontend-plugins/decklink-captions/CMakeLists.txt
index 3fc910b6c..0969dd7b0 100644
--- a/UI/frontend-plugins/decklink-captions/CMakeLists.txt
+++ b/UI/frontend-plugins/decklink-captions/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt b/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt
index a5e697e88..1fc0af541 100644
--- a/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt
+++ b/UI/frontend-plugins/decklink-output-ui/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/UI/frontend-plugins/frontend-tools/CMakeLists.txt b/UI/frontend-plugins/frontend-tools/CMakeLists.txt
index 5a0eeba45..b29d335a3 100644
--- a/UI/frontend-plugins/frontend-tools/CMakeLists.txt
+++ b/UI/frontend-plugins/frontend-tools/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/UI/obs-frontend-api/CMakeLists.txt b/UI/obs-frontend-api/CMakeLists.txt
index ca4eae513..fd7c9433b 100644
--- a/UI/obs-frontend-api/CMakeLists.txt
+++ b/UI/obs-frontend-api/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/deps/blake2/CMakeLists.txt b/deps/blake2/CMakeLists.txt
index b9fb338a8..6e31ec857 100644
--- a/deps/blake2/CMakeLists.txt
+++ b/deps/blake2/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
add_library(blake2 STATIC EXCLUDE_FROM_ALL )
add_library(OBS::blake2 ALIAS blake2)
diff --git a/deps/file-updater/CMakeLists.txt b/deps/file-updater/CMakeLists.txt
index e07cd2f0f..fbb358110 100644
--- a/deps/file-updater/CMakeLists.txt
+++ b/deps/file-updater/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
find_package(CURL REQUIRED)
diff --git a/deps/glad/CMakeLists.txt b/deps/glad/CMakeLists.txt
index 64b05a2cc..c6d7ea19c 100644
--- a/deps/glad/CMakeLists.txt
+++ b/deps/glad/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
find_package(OpenGL REQUIRED)
diff --git a/deps/happy-eyeballs/CMakeLists.txt b/deps/happy-eyeballs/CMakeLists.txt
index b3a5692cd..ff3be48ff 100644
--- a/deps/happy-eyeballs/CMakeLists.txt
+++ b/deps/happy-eyeballs/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
add_library(happy-eyeballs INTERFACE)
add_library(OBS::happy-eyeballs ALIAS happy-eyeballs)
diff --git a/deps/json11/CMakeLists.txt b/deps/json11/CMakeLists.txt
index 78cb7c94a..82d0a063b 100644
--- a/deps/json11/CMakeLists.txt
+++ b/deps/json11/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
add_library(json11 INTERFACE)
add_library(OBS::json11 ALIAS json11)
diff --git a/deps/libcaption/CMakeLists.txt b/deps/libcaption/CMakeLists.txt
index 53cd79196..2770b6746 100644
--- a/deps/libcaption/CMakeLists.txt
+++ b/deps/libcaption/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
add_library(caption STATIC EXCLUDE_FROM_ALL )
add_library(OBS::caption ALIAS caption)
diff --git a/deps/media-playback/CMakeLists.txt b/deps/media-playback/CMakeLists.txt
index a84900e47..351f4bb42 100644
--- a/deps/media-playback/CMakeLists.txt
+++ b/deps/media-playback/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
find_package(FFmpeg REQUIRED COMPONENTS avcodec avdevice avutil avformat)
diff --git a/deps/obs-scripting/CMakeLists.txt b/deps/obs-scripting/CMakeLists.txt
index 9096e4b27..988d2235c 100644
--- a/deps/obs-scripting/CMakeLists.txt
+++ b/deps/obs-scripting/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/deps/obs-scripting/obslua/CMakeLists.txt b/deps/obs-scripting/obslua/CMakeLists.txt
index 98517ee7d..22edd1e1c 100644
--- a/deps/obs-scripting/obslua/CMakeLists.txt
+++ b/deps/obs-scripting/obslua/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/deps/obs-scripting/obspython/CMakeLists.txt b/deps/obs-scripting/obspython/CMakeLists.txt
index f0db72f75..f0a07f66c 100644
--- a/deps/obs-scripting/obspython/CMakeLists.txt
+++ b/deps/obs-scripting/obspython/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/deps/opts-parser/CMakeLists.txt b/deps/opts-parser/CMakeLists.txt
index a87ee641e..72d61be53 100644
--- a/deps/opts-parser/CMakeLists.txt
+++ b/deps/opts-parser/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
add_library(opts-parser INTERFACE)
add_library(OBS::opts-parser ALIAS opts-parser)
diff --git a/deps/uthash/CMakeLists.txt b/deps/uthash/CMakeLists.txt
index aecb0d74e..7ebb524f0 100644
--- a/deps/uthash/CMakeLists.txt
+++ b/deps/uthash/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
add_library(uthash INTERFACE)
add_library(OBS::uthash ALIAS uthash)
diff --git a/libobs-opengl/CMakeLists.txt b/libobs-opengl/CMakeLists.txt
index 7ee9478ea..51751719d 100644
--- a/libobs-opengl/CMakeLists.txt
+++ b/libobs-opengl/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/libobs/CMakeLists.txt b/libobs/CMakeLists.txt
index 46112abe7..28551f61d 100644
--- a/libobs/CMakeLists.txt
+++ b/libobs/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index 90bea35be..26e6b57ec 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
option(ENABLE_PLUGINS "Enable building OBS plugins" ON)
diff --git a/plugins/aja/CMakeLists.txt b/plugins/aja/CMakeLists.txt
index 423d9d099..daaa57f51 100644
--- a/plugins/aja/CMakeLists.txt
+++ b/plugins/aja/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/decklink/CMakeLists.txt b/plugins/decklink/CMakeLists.txt
index e93c7c772..8423fe52a 100644
--- a/plugins/decklink/CMakeLists.txt
+++ b/plugins/decklink/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/image-source/CMakeLists.txt b/plugins/image-source/CMakeLists.txt
index a7682454e..2f5fd3790 100644
--- a/plugins/image-source/CMakeLists.txt
+++ b/plugins/image-source/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/obs-ffmpeg/CMakeLists.txt b/plugins/obs-ffmpeg/CMakeLists.txt
index 04530ef39..16c4d1e1a 100644
--- a/plugins/obs-ffmpeg/CMakeLists.txt
+++ b/plugins/obs-ffmpeg/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt b/plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt
index afa22b7a5..5644f8213 100644
--- a/plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt
+++ b/plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/obs-filters/CMakeLists.txt b/plugins/obs-filters/CMakeLists.txt
index 22d79388c..84b337c40 100644
--- a/plugins/obs-filters/CMakeLists.txt
+++ b/plugins/obs-filters/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/obs-outputs/CMakeLists.txt b/plugins/obs-outputs/CMakeLists.txt
index cedc77da0..f131ca671 100644
--- a/plugins/obs-outputs/CMakeLists.txt
+++ b/plugins/obs-outputs/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/obs-qsv11/CMakeLists.txt b/plugins/obs-qsv11/CMakeLists.txt
index cae152765..f1c39cc6a 100644
--- a/plugins/obs-qsv11/CMakeLists.txt
+++ b/plugins/obs-qsv11/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/obs-transitions/CMakeLists.txt b/plugins/obs-transitions/CMakeLists.txt
index 65e3b13ac..c18ac96ed 100644
--- a/plugins/obs-transitions/CMakeLists.txt
+++ b/plugins/obs-transitions/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/obs-vst/CMakeLists.txt b/plugins/obs-vst/CMakeLists.txt
index bb5c32a00..78530783b 100644
--- a/plugins/obs-vst/CMakeLists.txt
+++ b/plugins/obs-vst/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/obs-webrtc/CMakeLists.txt b/plugins/obs-webrtc/CMakeLists.txt
index de943062f..84b0f1aa5 100644
--- a/plugins/obs-webrtc/CMakeLists.txt
+++ b/plugins/obs-webrtc/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/obs-x264/CMakeLists.txt b/plugins/obs-x264/CMakeLists.txt
index 4c293fb33..c75491a51 100644
--- a/plugins/obs-x264/CMakeLists.txt
+++ b/plugins/obs-x264/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/rtmp-services/CMakeLists.txt b/plugins/rtmp-services/CMakeLists.txt
index e8d304ae0..9dc0b2396 100644
--- a/plugins/rtmp-services/CMakeLists.txt
+++ b/plugins/rtmp-services/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/text-freetype2/CMakeLists.txt b/plugins/text-freetype2/CMakeLists.txt
index bb30f99a7..b19b0cd57 100644
--- a/plugins/text-freetype2/CMakeLists.txt
+++ b/plugins/text-freetype2/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
diff --git a/plugins/vlc-video/CMakeLists.txt b/plugins/vlc-video/CMakeLists.txt
index 0a35ae284..40a62b076 100644
--- a/plugins/vlc-video/CMakeLists.txt
+++ b/plugins/vlc-video/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.22...3.25)
+cmake_minimum_required(VERSION 3.20...3.25)
legacy_check()
--
2.41.0

View File

@ -0,0 +1,36 @@
From 841fd01b7a529b7c1d0e0a509190a26eb1220d5a Mon Sep 17 00:00:00 2001
From: Neal Gompa <neal@gompa.dev>
Date: Thu, 4 May 2023 13:52:01 -0400
Subject: [PATCH] UI: Default to fdk-aac for AAC when auto-configuring settings
We always have the FDK-AAC codec available, and it's a better
codec anyway.
---
UI/window-basic-auto-config-test.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/UI/window-basic-auto-config-test.cpp b/UI/window-basic-auto-config-test.cpp
index c791c8b8b..7dabfd93f 100644
--- a/UI/window-basic-auto-config-test.cpp
+++ b/UI/window-basic-auto-config-test.cpp
@@ -202,7 +202,7 @@ void AutoConfigTestPage::TestBandwidthThread()
(wiz->x264Available ? "obs_x264" : "ffmpeg_openh264"),
"test_h264", nullptr, nullptr);
OBSEncoderAutoRelease aencoder = obs_audio_encoder_create(
- "ffmpeg_aac", "test_aac", nullptr, 0, nullptr);
+ "libfdk_aac", "test_aac", nullptr, 0, nullptr);
OBSServiceAutoRelease service = obs_service_create(
serverType, "test_service", nullptr, nullptr);
@@ -572,7 +572,7 @@ bool AutoConfigTestPage::TestSoftwareEncoding()
(wiz->x264Available ? "obs_x264" : "ffmpeg_openh264"),
"test_h264", nullptr, nullptr);
OBSEncoderAutoRelease aencoder = obs_audio_encoder_create(
- "ffmpeg_aac", "test_aac", nullptr, 0, nullptr);
+ "libfdk_aac", "test_aac", nullptr, 0, nullptr);
OBSOutputAutoRelease output =
obs_output_create("null_output", "null", nullptr, nullptr);
--
2.40.0

View File

@ -0,0 +1,218 @@
From b6be0b4bf5b0b2f26c8143641881cde23ac8ba9c Mon Sep 17 00:00:00 2001
From: Neal Gompa <neal@gompa.dev>
Date: Wed, 26 Apr 2023 07:56:35 -0400
Subject: [PATCH 1/2] deps: Add license declaration files
---
deps/blake2/LICENSE.blake2 | 19 ++++++++++
deps/libff/LICENSE.libff | 18 ++++++++++
deps/media-playback/LICENSE.media-playback | 19 ++++++++++
libobs/graphics/libnsgif/LICENSE.libnsgif | 33 ++++++++++++++++++
libobs/util/simde/LICENSE.simde | 40 ++++++++++++++++++++++
plugins/decklink/LICENSE.decklink-sdk | 30 ++++++++++++++++
6 files changed, 159 insertions(+)
create mode 100644 deps/blake2/LICENSE.blake2
create mode 100644 deps/libff/LICENSE.libff
create mode 100644 deps/media-playback/LICENSE.media-playback
create mode 100644 libobs/graphics/libnsgif/LICENSE.libnsgif
create mode 100644 libobs/util/simde/LICENSE.simde
create mode 100644 plugins/decklink/LICENSE.decklink-sdk
diff --git a/deps/blake2/LICENSE.blake2 b/deps/blake2/LICENSE.blake2
new file mode 100644
index 000000000..3a8abc787
--- /dev/null
+++ b/deps/blake2/LICENSE.blake2
@@ -0,0 +1,19 @@
+BLAKE2 is licensed to permit usage under the terms of the CC0, the OpenSSL License,
+ or the Apache Public License 2.0 at the user's option.
+
+The license grant is reproduced in full below.
+
+/*
+ BLAKE2 reference source code package - reference C implementations
+
+ Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
+ terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
+ your option. The terms of these licenses can be found at:
+
+ - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
+ - OpenSSL license : https://www.openssl.org/source/license.html
+ - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
+
+ More information about the BLAKE2 hash function can be found at
+ https://blake2.net.
+*/
diff --git a/deps/libff/LICENSE.libff b/deps/libff/LICENSE.libff
new file mode 100644
index 000000000..b6f51157a
--- /dev/null
+++ b/deps/libff/LICENSE.libff
@@ -0,0 +1,18 @@
+libff is licensed under the ISC license. The license terms are fully
+reproduced below:
+
+/*
+ * Copyright (c) 2015 John R. Bradley <jrb@turrettech.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
diff --git a/deps/media-playback/LICENSE.media-playback b/deps/media-playback/LICENSE.media-playback
new file mode 100644
index 000000000..17d74f4b3
--- /dev/null
+++ b/deps/media-playback/LICENSE.media-playback
@@ -0,0 +1,19 @@
+media-playback is licensed under the ISC license. The license terms are fully
+reproduced below:
+
+
+/*
+ * Copyright (c) 2023 Hugh Bailey <obs.jim@gmail.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
diff --git a/libobs/graphics/libnsgif/LICENSE.libnsgif b/libobs/graphics/libnsgif/LICENSE.libnsgif
new file mode 100644
index 000000000..9b28c0b45
--- /dev/null
+++ b/libobs/graphics/libnsgif/LICENSE.libnsgif
@@ -0,0 +1,33 @@
+libnsgif is licensed under the MIT license. The licensing statement
+and the full license are reproduced below.
+
+/*
+ * Copyright 2003 James Bursa <bursa@users.sourceforge.net>
+ * Copyright 2004 John Tytgat <John.Tytgat@aaug.net>
+ * Copyright 2004 Richard Wilson <richard.wilson@netsurf-browser.org>
+ * Copyright 2008 Sean Fox <dyntryx@gmail.com>
+ *
+ * This file is part of NetSurf's libnsgif, http://www.netsurf-browser.org/
+ * Licenced under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ */
+
+The MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/libobs/util/simde/LICENSE.simde b/libobs/util/simde/LICENSE.simde
new file mode 100644
index 000000000..78d482e75
--- /dev/null
+++ b/libobs/util/simde/LICENSE.simde
@@ -0,0 +1,40 @@
+simde is licensed as a combination of MIT and CC0 code.
+
+License notices for both are reproduced below:
+
+/* SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Copyright:
+ * 2017-2020 Evan Nemerson <evan@nemerson.com>
+ */
+
+/* Portable Snippets - https://gitub.com/nemequ/portable-snippets
+ * Created by Evan Nemerson <evan@nemerson.com>
+ *
+ * To the extent possible under law, the authors have waived all
+ * copyright and related or neighboring rights to this code. For
+ * details, see the Creative Commons Zero 1.0 Universal license at
+ * https://creativecommons.org/publicdomain/zero/1.0/
+ *
+ * SPDX-License-Identifier: CC0-1.0
+ */
diff --git a/plugins/decklink/LICENSE.decklink-sdk b/plugins/decklink/LICENSE.decklink-sdk
new file mode 100644
index 000000000..d320d805b
--- /dev/null
+++ b/plugins/decklink/LICENSE.decklink-sdk
@@ -0,0 +1,30 @@
+decklink-sdk is licensed under to Boost Software License 1.0 (BSL-1.0).
+
+The license text is reproduced in full below:
+
+/* -LICENSE-START-
+** Copyright (c) 2020 Blackmagic Design
+**
+** Permission is hereby granted, free of charge, to any person or organization
+** obtaining a copy of the software and accompanying documentation covered by
+** this license (the "Software") to use, reproduce, display, distribute,
+** execute, and transmit the Software, and to prepare derivative works of the
+** Software, and to permit third-parties to whom the Software is furnished to
+** do so, all subject to the following:
+**
+** The copyright notices in the Software and this entire statement, including
+** the above license grant, this restriction and the following disclaimer,
+** must be included in all copies of the Software, in whole or in part, and
+** all derivative works of the Software, unless such copies or derivative
+** works are solely in the form of machine-executable object code generated by
+** a source language processor.
+**
+** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+** DEALINGS IN THE SOFTWARE.
+** -LICENSE-END-
+*/
--
2.40.0