diff options
author | 2024-04-22 00:47:58 +0200 | |
---|---|---|
committer | 2024-04-22 00:47:58 +0200 | |
commit | 4e55d5d24df95feeb3aabf49263c77cd29a2d877 (patch) | |
tree | cc6d193f1834f8bda646644c4aefa23e6ddc0fca /kpipewire | |
parent | initial commit (diff) | |
download | misc-patches-4e55d5d24df95feeb3aabf49263c77cd29a2d877.tar.xz |
screen recordings with MagicYUV and Spectacle
On Windows I use Bandicamp and MagicYUV to record gameplay losslessly
with minimal CPU impact. However, Spectacle only supports encoding with
H264 or WebM, which is neither lossless nor light on the CPU.
This changeset adds support for the MagicYUV 4:4:4 codec to Spectacle
and the underlying kpipewire plumbing.
Diffstat (limited to 'kpipewire')
-rw-r--r-- | kpipewire/5.27-magicyuv-yuv444.patch | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/kpipewire/5.27-magicyuv-yuv444.patch b/kpipewire/5.27-magicyuv-yuv444.patch new file mode 100644 index 0000000..c742afc --- /dev/null +++ b/kpipewire/5.27-magicyuv-yuv444.patch @@ -0,0 +1,51 @@ +From e943d0ca542b4e4f4c458165fdcdc8e413c3d2a5 Mon Sep 17 00:00:00 2001 +From: Terin Stock <terinjokes@gmail.com> +Date: Mon, 22 Apr 2024 00:29:34 +0200 +Subject: [PATCH] Record: support MagicYUV 4:4:4 + +The two codecs currently supported, H264 and WebM are not suitable for +recording with minimal CPU overhead and losslessly for farther editing +or archiving. + +This changeset adds support for recording in MagicYUV 4:4:4 in a +Matroska container. This is suitably fast and satisfies the lossless +goal, while still having some compression. These can be transcoded to +FFV1 with no quality loss offline. +--- + src/pipewirerecord.cpp | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/src/pipewirerecord.cpp b/src/pipewirerecord.cpp +index ac8132e..232bbd6 100644 +--- a/src/pipewirerecord.cpp ++++ b/src/pipewirerecord.cpp +@@ -301,10 +301,14 @@ void PipeWireRecordProduce::setupStream() + m_avCodecContext->height = size.height(); + m_avCodecContext->max_b_frames = 1; + m_avCodecContext->gop_size = 100; +- if (m_codec->pix_fmts && m_codec->pix_fmts[0] > 0) { +- m_avCodecContext->pix_fmt = m_codec->pix_fmts[0]; ++ if (QStringLiteral("magicyuv") == QString::fromUtf8(m_encoder)) { ++ m_avCodecContext->pix_fmt = AV_PIX_FMT_YUV444P; + } else { +- m_avCodecContext->pix_fmt = AV_PIX_FMT_YUV420P; ++ if (m_codec->pix_fmts && m_codec->pix_fmts[0] > 0) { ++ m_avCodecContext->pix_fmt = m_codec->pix_fmts[0]; ++ } else { ++ m_avCodecContext->pix_fmt = AV_PIX_FMT_YUV420P; ++ } + } + m_avCodecContext->time_base = AVRational{1, 1000}; + +@@ -462,7 +466,7 @@ QByteArray PipeWireRecord::encoder() const + + QList<QByteArray> PipeWireRecord::suggestedEncoders() const + { +- QList<QByteArray> ret = {"libvpx", "libx264"}; ++ QList<QByteArray> ret = {"libvpx", "libx264", "magicyuv"}; + std::remove_if(ret.begin(), ret.end(), [](const QByteArray &encoder) { + return !avcodec_find_encoder_by_name(encoder.constData()); + }); +-- +2.43.2 + |