Bug 516848 - Spectacle frequently fails to save screen recordings
Summary: Spectacle frequently fails to save screen recordings
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (other bugs)
Version First Reported In: 6.5.4
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-02-28 12:23 UTC by Brent Spillner
Modified: 2026-10-05 20:57 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.8.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brent Spillner 2026-02-28 12:23:26 UTC
SUMMARY

Spectacle under Wayland frequently (about 2/3 of the time) fails to save screen recordings of a single window or rectangular region.  The other 1/3 of the time, the recording saves as expected, without any change in window (or selected rectangle) size, position, contents, underlying system software or settings, or background applications.  That is to say, I can open an application, open Spectacle, try to make a recording, get a pop-up error message, try again, succeed, try again, and get another error message, without changing anything at all in my desktop session.  The error message appears only when I stop the recording (which is extra annoying, because I've already stepped through whatever I was trying to record, and am not presented with any options to try to re-save that artifact).

When it fails, Spectacle pops-up an error dialog with the text "Failed to export video: Temporary file URL must be an existing local file", and I get

[libvpx-vp9 @ 0x7fce084fd780] v1.15.2
kpipewire_dmabuf_logging: eglChooseConfig returned this many configs: 1
Failed to export video: Temporary file URL must be an existing local file

in my plasmashell log.  Spectacle is configured to save recordings in WebM/VP9 format, the save location exists and is writable, and there is over 1TB of free space on that filesystem. 

Bug #485733 reports very similar symptoms, but that involved MP4 encoding, as is marked as resolved (although other users continued to comment that they are seeing the same error message afterward, perhaps due to other causes).

I have not yet seen the error when recording the full screen, although I've only tried a few times.  I am not experiencing any other video or audio anomalies or instability on this system.

STEPS TO REPRODUCE
1. Open Spectacle
2. Start a new recording with either the "Window" or "Rectangular Region" buttons on the "Recording" tab, or the equivalent keyboard shortcuts (e.g. Meta-Ctl-R / Meta-Shift-R)
3. Stop your recording with either the red Stop button on the Plasma panel, or the same keyboard shortcut.
4. Roll one six-sided die.  With a frequency approximately equal to that of rolling 1, 2, 3, or 4, Spectacle will report "Failed to export video: Temporary file URL must be an existing local file" and no data will be saved.  The remainder of the time, the file will be saved normally with no indications of any error.
5.  If your recording /was/ saved normally, return to step 2.

OBSERVED RESULT
On failure, a pop-up dialog with title "Error --- Spectacle", an error icon (white X against a red octagon), the text "Failed to export video: Temporary file URL must be an existing local file", and a single "OK" button even though this is very much not OK.

EXPECTED RESULT
Spectacle consistently saves the recorded screen data.  When an error is detected during the saving process, Spectacle should offer to let the user choose a new destination and re-try.

SOFTWARE/OS VERSIONS
Linux: 6.18.7 (x86_64)
KDE Plasma Version: 6.5.4
KDE Frameworks Version:  6.22.0
Qt Version: 6.10.1
Wayland: 1.24.0
wayland-protocols: 1.47
Pipewire: 1.4.10
Mesa: 25.3.3
Comment 1 Nate Graham 2026-03-03 19:08:01 UTC
Hmm, this was supposed to be fixed in Bug 485733. Maybe you're hitting a new issue with the same outward symptoms.
Comment 2 Noah Davis 2026-03-03 22:01:05 UTC
I tried to do 20 consecutive rectangle recordings using Meta+Shift+R and wasn't able to reproduce the issue. They were all a few seconds long at most, so I'm not sure if duration plays a part in reproducing the issue.
Comment 3 Brent Spillner 2026-03-03 22:33:52 UTC
(In reply to Noah Davis from comment #2)
> I tried to do 20 consecutive rectangle recordings using Meta+Shift+R and
> wasn't able to reproduce the issue. They were all a few seconds long at
> most, so I'm not sure if duration plays a part in reproducing the issue.

Out of curiosity, what is your libvpx version?  On a hunch, I upgraded from version 1.15.2 to 1.16.0, and I haven't yet had any failures under the new shared library.  Other than a libplacebo upgrade (7.351.0 to 7.360.0), I haven't changed anything else on this system that could even remotely be relevant to Spectacle, Wayland, or video encoding.
Comment 4 Bug Janitor Service 2026-09-12 13:05:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/spectacle/-/merge_requests/590
Comment 5 Noah Davis 2026-09-12 17:28:10 UTC
(In reply to Brent Spillner from comment #3)
> Out of curiosity, what is your libvpx version?  On a hunch, I upgraded from
> version 1.15.2 to 1.16.0, and I haven't yet had any failures under the new
> shared library.  Other than a libplacebo upgrade (7.351.0 to 7.360.0), I
> haven't changed anything else on this system that could even remotely be
> relevant to Spectacle, Wayland, or video encoding.

1.16.0. Sorry for the late reply.
Comment 6 Noah Davis 2026-09-30 11:42:27 UTC
Git commit 7dd8f49ad555428eea695c5bfebd806a72c9c7c0 by Noah Davis, on behalf of Zhora Zmeykin.
Committed on 30/09/2026 at 11:42.
Pushed by ndavis into branch 'master'.

Prevent premature exit during recording startup

I encountered this issue mostly in a VM. It appears to be a race between the application lifecycle and asynchronous operations. I addressed it by adding a separate `QEventLoopLocker`.

During testing, I added debug logging with `qWarning()` to `SpectacleCore::startRecording()`, `VideoPlatformWayland::selectAndRecord()`, `QCoreApplication::aboutToQuit`, `ScreencastingStream::created`, and `PipeWireRecord::stateChanged`. This produced the following log:

```text
0.000 startRecording Screen captureWindows 1
0.000 hiding capture windows
0.002 calling VideoPlatform::startRecording
0.002 requesting KWin screen selection
1.115 KWin selection reply valid
1.115 selected screen "Virtual-1"
1.115 screencasting stream object created; awaiting created/failed signal
1.190 QCoreApplication::aboutToQuit
1.227 PipeWireRecord::stateChanged ... Idle
```

The `ScreencastingStream::created` signal is never emitted, the application does not reach the `Recording` state, and no recording file is created.

After adding `QEventLoopLocker`:

```text
0.000 startRecording Screen captureWindows 1
0.000 installing QEventLoopLocker
0.000 hiding capture windows
0.002 calling VideoPlatform::startRecording
0.002 requesting KWin screen selection
1.336 KWin selection reply valid
1.336 selected screen "Virtual-1"
1.337 screencasting stream object created; awaiting created/failed signal
1.364 ScreencastingStream::created 61
1.515 PipeWireRecord::stateChanged ... Recording
```

With this change, the recording reached the `Recording` state and the video was recorded successfully.

M  +9    -2    src/SpectacleCore.cpp
M  +1    -0    src/SpectacleCore.h

https://invent.kde.org/plasma/spectacle/-/commit/7dd8f49ad555428eea695c5bfebd806a72c9c7c0
Comment 7 Noah Davis 2026-09-30 19:36:37 UTC
Git commit 393d4be54e2482cc6bd7d84a5bb4f0df46cd326f by Noah Davis.
Committed on 30/09/2026 at 19:36.
Pushed by ndavis into branch 'Plasma/6.8'.

Prevent premature exit during recording startup

I encountered this issue mostly in a VM. It appears to be a race between the application lifecycle and asynchronous operations. I addressed it by adding a separate `QEventLoopLocker`.

During testing, I added debug logging with `qWarning()` to `SpectacleCore::startRecording()`, `VideoPlatformWayland::selectAndRecord()`, `QCoreApplication::aboutToQuit`, `ScreencastingStream::created`, and `PipeWireRecord::stateChanged`. This produced the following log:

```text
0.000 startRecording Screen captureWindows 1
0.000 hiding capture windows
0.002 calling VideoPlatform::startRecording
0.002 requesting KWin screen selection
1.115 KWin selection reply valid
1.115 selected screen "Virtual-1"
1.115 screencasting stream object created; awaiting created/failed signal
1.190 QCoreApplication::aboutToQuit
1.227 PipeWireRecord::stateChanged ... Idle
```

The `ScreencastingStream::created` signal is never emitted, the application does not reach the `Recording` state, and no recording file is created.

After adding `QEventLoopLocker`:

```text
0.000 startRecording Screen captureWindows 1
0.000 installing QEventLoopLocker
0.000 hiding capture windows
0.002 calling VideoPlatform::startRecording
0.002 requesting KWin screen selection
1.336 KWin selection reply valid
1.336 selected screen "Virtual-1"
1.337 screencasting stream object created; awaiting created/failed signal
1.364 ScreencastingStream::created 61
1.515 PipeWireRecord::stateChanged ... Recording
```

With this change, the recording reached the `Recording` state and the video was recorded successfully.

(cherry picked from commit 7dd8f49ad555428eea695c5bfebd806a72c9c7c0)

Co-authored-by: Zhora Zmeykin <me@katze-942.ru>

M  +9    -2    src/SpectacleCore.cpp
M  +1    -0    src/SpectacleCore.h

https://invent.kde.org/plasma/spectacle/-/commit/393d4be54e2482cc6bd7d84a5bb4f0df46cd326f