Bug 471159

Summary: Spectacle screen recording cuts off the last bit of the video
Product: [Applications] Spectacle Reporter: aronkvh
Component: GeneralAssignee: Noah Davis <noahadvs>
Status: RESOLVED FIXED    
Severity: major CC: 4wy78uwh, adelauney96, bugseforuns, ckx, el, jexodusmercado, kde, kdedev, lehoangphuongbg, nate
Priority: VHI    
Version: 23.04.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 6.2.1
Sentry Crash Report:

Description aronkvh 2023-06-17 14:06:57 UTC
I'm trying to record a screencast using spectacle, but the time counter doesn't stop when I click stop, only several (5-10) seconds later or not at all. When it does stop eventually the result is a couple seconds shorter than it should be.

Operating System: KDE neon 5.27
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.107.0
Qt Version: 5.15.10
Kernel Version: 5.19.0-43-generic (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-3770 CPU @ 3.40GHz
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3060/PCIe/SSE2
Comment 1 Patrick Silva 2023-06-18 14:00:47 UTC
Same with Spectacle 23.04.2 on Arch Linux.
Comment 2 adelauney96 2023-10-16 01:19:57 UTC
I experience this issue as well On Fedora 39 Prerelease

KDE Plasma: 5.27.8
KDE Frameworks: 5.110.0
QT Version: 5.15.10
Kernel: 6.5.6-300.f39.x86_64
Graphics Platform: Wayland

CPU: AMD Ryzen 3600
GPU: NVidia 3080 ti

I have a feeling it might be Nvidia related :(
Comment 3 ckx 2024-07-17 17:05:05 UTC
(In reply to adelauney96 from comment #2)
> I have a feeling it might be Nvidia related :(
F40, I have the same issue on an AMD 6950XT
Comment 4 Patrick Silva 2024-07-22 20:12:52 UTC
Same problem on my system. I use intel iGPU.

Operating System: Arch Linux 
KDE Plasma Version: 6.1.3
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2
Kernel Version: 6.9.10-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-4670K CPU @ 3.40GHz
Memory: 31,2 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 4600
Comment 5 Lê Hoàng Phương 2024-08-12 11:53:39 UTC
Still have same issue, fedora 40, plasma 6.1.3, spectacle 24.05.2, Intel xe graphics
Comment 6 Nate Graham 2024-08-13 19:37:06 UTC
Can reproduce with current git master too.
Comment 7 Nate Graham 2024-08-13 19:37:54 UTC
*** Bug 491496 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2024-08-19 21:43:27 UTC
FWIW I can reproduce this with Webm/VP9 recordings, but not MP4/H.264 recordings.
Comment 9 Nate Graham 2024-10-01 16:54:23 UTC
*** Bug 493929 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2024-10-01 17:15:10 UTC
*** Bug 493891 has been marked as a duplicate of this bug. ***
Comment 11 Bug Janitor Service 2024-10-08 11:07:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kpipewire/-/merge_requests/172
Comment 12 Bug Janitor Service 2024-10-08 12:22:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kpipewire/-/merge_requests/173
Comment 13 Arjen Hiemstra 2024-10-10 14:08:36 UTC
Git commit 3ef5a5312ff0b072c04d99032ef88088cef3a9de by Arjen Hiemstra.
Committed on 09/10/2024 at 12:41.
Pushed by ahiemstra into branch 'master'.

produce: Flush remaining frames when we are deactivating

When we deactivate, we may still have a bunch of frames in FFmpeg's
filter or encode queues. Currently, if that happens, we simply discard
those frames and tear everything down, which results in files missing
several frames that were actually recorded.

To avoid that, if we know we still have frames in the queues, wait with
teardown until we know all frames have been processed.

This does mean `setActive(false)` can take a while to complete since the
queues might have a large amount of frames remaining, but fixing that
properly requires a different API.

M  +44   -5    src/pipewireproduce.cpp
M  +2    -0    src/pipewireproduce_p.h
M  +0    -5    src/pipewirerecord.cpp

https://invent.kde.org/plasma/kpipewire/-/commit/3ef5a5312ff0b072c04d99032ef88088cef3a9de
Comment 14 Arjen Hiemstra 2024-10-10 14:10:21 UTC
Git commit f865aa35f91b63af94a1b17c4dc95a69c32ef51e by Arjen Hiemstra.
Committed on 10/10/2024 at 14:08.
Pushed by ahiemstra into branch 'Plasma/6.2'.

produce: Flush remaining frames when we are deactivating

When we deactivate, we may still have a bunch of frames in FFmpeg's
filter or encode queues. Currently, if that happens, we simply discard
those frames and tear everything down, which results in files missing
several frames that were actually recorded.

To avoid that, if we know we still have frames in the queues, wait with
teardown until we know all frames have been processed.

This does mean `setActive(false)` can take a while to complete since the
queues might have a large amount of frames remaining, but fixing that
properly requires a different API.


(cherry picked from commit 3ef5a5312ff0b072c04d99032ef88088cef3a9de)

Co-authored-by: Arjen Hiemstra <ahiemstra@heimr.nl>

M  +44   -5    src/pipewireproduce.cpp
M  +2    -0    src/pipewireproduce_p.h
M  +0    -5    src/pipewirerecord.cpp

https://invent.kde.org/plasma/kpipewire/-/commit/f865aa35f91b63af94a1b17c4dc95a69c32ef51e