summaryrefslogtreecommitdiff
path: root/kpipewire
diff options
context:
space:
mode:
Diffstat (limited to 'kpipewire')
-rw-r--r--kpipewire/5.27-magicyuv-yuv444.patch51
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
+