Skip to content

Produce: Drop frames with a PTS equal or lower to the last frame

Arjen Hiemstra requested to merge work/ahiemstra/dupeframes into master

In some cases, we end up with frames that have an FFmpeg PTS equal to the previous frame. When this happens, both libx264 and FFmpeg will start complaining and we get a bunch of logging about frame writes failing. I suspect this happens because we have nanosecond scale PTS in KWin/PipeWire but FFmpeg only has millisecond scale PTS, so we end up with frames with the same millisecond PTS after narrowing. Since FFmpeg refuses to write these frames anyway, we may as well drop them before we even pass them to the encoder.

Merge request reports