FFmpeg - Recording issue

I find the internal Retroarch’s recording feature, with the lossless and “Use GPU Recording” enabled the best way to record short clips, but there are somethings I’d like to understand. When Use GPU Recording is enabled, the gameplay becomes very choppy, like it’s capturing frame by frame, it’s not a big deal for short clips, I just would like to know why it happens. The only issue about the output files is that the last 4 seconds of each video gets corrupted, for example, if I record 60 seconds, the player will reproduce 56, note how the explorer clearly shows 49 seconds, while the player says otherwise:

The corruption is noticiable when the player resumes the video if I stop and close it while it was playing, when reopened, the video codec display a garbled output.

Is it a known issue, anything I could do to fix it?

The GPU recording option means it will record the fully scaled/filtered output of the GPU, not that it will use the GPU to do the recording. Without GPU recording, it will only dump the small, native res image with no shaders or scaling on top.

I’m not sure, but I think the time/corruption may be related to keyframes.

So I assume it works differently from what a third party recorder does, is that right? I mean, it’s like raw output judging it’s quality.

So this is something that needs fixing, isn’t related to any config then?

And yet again I need to mention that in GL/GLCore the recording eats up to 60%~ of the CPU while it stays in 30%~ in Vulkan.

I figured the video corruption is probably at the beginning of the file, I have cut the video without re-coding it. Cutting the last 10 seconds, for instance, won’t corrupt the video, but if I cut the first seconds, it will display garbage.