https://bugs.kde.org/show_bug.cgi?id=518009
Bug ID: 518009
Summary: KPipeWire MP4/H.264 recordings can generate
non-monotonic PTS/DTS and muxer errors because
repeated frames reuse the same timestamp
Classification: Frameworks and Libraries
Product: KPipeWire
Version First 6.6.3
Reported In:
Platform: NixOS
OS: Linux
Status: REPORTED
Severity: major
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: ---
SUMMARY
KPipeWire's recording pipeline can reuse the same presentation timestamp for
repeated frames, which leads to non-monotonic PTS/DTS and MP4 muxer errors
during H.264 recording.
This appears to happen in the repeated-frame path used when the screen is
static and the last frame is pushed through the encoder again.
STEPS TO REPRODUCE
1. Start a screen recording in Spectacle using MP4/H.264.
2. Record normally and stop the recording.
3. Watch the terminal/log output during recording and finalization.
OBSERVED RESULT
KPipeWire/FFmpeg emitted repeated timestamp/muxer errors such as:
[libx264 @ ...] non-strictly-monotonic PTS
[mp4 @ ...] Application provided invalid, non monotonically increasing dts to
muxer in stream 0: 63360 >= 63360
kpipewire_record_logging: Error while writing output packet: Invalid argument
More examples from the same recording:
[mp4 @ ...] Application provided invalid, non monotonically increasing dts to
muxer in stream 0: 73530 >= 73530
kpipewire_record_logging: Error while writing output packet: Invalid argument
[mp4 @ ...] Application provided invalid, non monotonically increasing dts to
muxer in stream 0: 84240 >= 84240
kpipewire_record_logging: Error while writing output packet: Invalid argument
The file could still be created, but the muxer was clearly receiving invalid
packet timestamps.
EXPECTED RESULT
Repeated frames should receive monotonically increasing timestamps, and
MP4/H.264 recording should not emit non-monotonic PTS/DTS or packet write
errors.
SOFTWARE/OS VERSIONS
Operating System: NixOS Unstable channel
KDE Plasma Version: 6.6.3
KDE Frameworks Version: 6.24.0
Qt Version: 6.10.2
Kernel Version: 6.19.8 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 4600H with Radeon Graphics
Memory: 40 GiB of RAM (38.6 GiB usable)
Graphics Processor 1: NVIDIA GeForce GTX 1650
Graphics Processor 2: AMD Radeon Graphics
ADDITIONAL INFORMATION
The likely cause is that the frame-repeat timer resends the last frame with the
same presentation timestamp instead of advancing it. That can produce duplicate
timestamps which later become duplicate DTS after rescaling/muxing.
I tested a local fix that:
- advances the repeated-frame timestamp by one frame interval
- requests encoder drain once
- waits for drain completion before cleanup
With that patch:
- MP4/H.264 recording no longer emits non-monotonic PTS/DTS warnings
- muxer packet write errors disappear
- recording finalization behaves correctly
The patch will be in the MR
--
You are receiving this mail because:
You are watching all bug changes.