https://bugs.kde.org/show_bug.cgi?id=529209

            Bug ID: 529209
           Summary: Spectacle fails to record animated WebP: Frame size or
                    pixel format does not match the encoder
    Classification: Frameworks and Libraries
           Product: KPipeWire
      Version First unspecified
       Reported In:
          Platform: CachyOS
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

## DESCRIPTION

Spectacle fails to record animated WebP files on KDE Plasma Wayland.

When recording in WebP format, KPipeWire repeatedly reports a pixel format or
frame size mismatch from the FFmpeg libwebp encoder.

The generated WebP file is invalid and cannot be opened.

Other recording formats (GIF, WebM, and MP4) work correctly on the same system.

## STEPS TO REPRODUCE

1. Open Spectacle in a KDE Plasma Wayland session.
2. Select screen recording mode and choose WebP as the output format.
3. Start recording, wait a few seconds, and stop the recording.

## OBSERVED RESULT

The generated WebP file is invalid and cannot be opened or previewed.

The following errors repeatedly appear in the terminal:

```
[libwebp] Frame size or pixel format does not match the encoder
kpipewire_record_logging: Error sending a frame for encoding: Invalid argument
```

After recording, Spectacle reports:

```
qt.multimedia.ffmpeg.mediadataholder: Could not open media. FFmpeg error
description: Invalid data found when processing input
QML AnimatedImage: Error Reading Animated Image File
```

## EXPECTED RESULT

Spectacle should successfully record and save a valid animated WebP file.

## SOFTWARE/OS VERSIONS

Operating System: CachyOS Linux

KDE Plasma Version: 6.8.3

KDE Frameworks Version: 6.32.0

Qt Version: 6.12.0

Kernel Version: 7.3.5-2-cachyos (64-bit)

Graphics Platform: Wayland

CPU: AMD Ryzen AI 9 HX 370

GPU: AMD Radeon 890M Graphics

Mesa: 26.3.1-arch3.4

KPipeWire: 6.8.3-1.1

Spectacle: 6.8.3-1.1

FFmpeg: 9.1-1.1 (Arch package version: 2:9.1-1.1)

## ADDITIONAL INFORMATION

The issue appears to be specific to the WebP encoding path in KPipeWire.

I noticed a possible pixel format mismatch in the KPipeWire source code.

In `src/libwebpencoder.cpp`, the encoder is configured with:

```
m_avCodecContext->pix_fmt = AV_PIX_FMT_YUVA420P;
```

However, the default filter graph in `src/encoder_p.h` uses:

```
QStringLiteral("format=pix_fmts=yuv420p")
```

If this filter graph is used without modification, the output pixel format may
not match the encoder configuration.

This could explain the FFmpeg error, although I have not tested a patched build
to confirm it.

Relevant source files:

https://invent.kde.org/plasma/kpipewire/-/blob/master/src/libwebpencoder.cpp

https://invent.kde.org/plasma/kpipewire/-/blob/master/src/encoder_p.h

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to