mifi / lossless-cut

The swiss army knife of lossless video/audio editing
GNU General Public License v2.0
24.24k stars 1.21k forks source link

120 fps video stutters in playback window #1904

Closed Rytoxz closed 4 months ago

Rytoxz commented 4 months ago

The fewer issues I have to read, the more new features I will have time to implement, so I ask that you please try these things first

Operating System

Windows 11

Steps to reproduce

Open a 120 fps video in lossless cut (such as below) and frame pacing is poor with stuttering in the playback window. This does not happen with 60 fps clips. The new NVIDIA app (https://www.nvidia.com/en-us/geforce/news/nvidia-app-beta-download/) allows for recording at 120 fps.

https://github.com/mifi/lossless-cut/assets/134399545/db385614-7da0-4ed9-9008-df85b1d89e6e

Expected behavior

The clip should playback smoothly like a 60 fps clip.

Actual behavior

The clip plays back in a desynced manner with stuttering.

120 fps playback:

https://github.com/mifi/lossless-cut/assets/134399545/b6cffabc-81f7-474b-997f-282179129e1e

60 fps playback:

https://github.com/mifi/lossless-cut/assets/134399545/265bfeba-ad23-449e-bc71-2479457cb223

Share log from developer tools

No response

mifi commented 4 months ago

could u share more info about the file? https://github.com/mifi/lossless-cut/issues/new?assignees=&labels=&projects=&template=1-file-issue.yml

mifi commented 4 months ago

or is it happening with all files? e.g. normal h264 files too

Rytoxz commented 4 months ago

Hi @mifi. This occurs with all files recorded with the 120 fps option selected in the new NVIDIA app. When the app is set to record at 60 fps this issues does not occur.

NVIDIA Shadowplay recordings use a constant bitrate so unsure if that is related. Currently it can only record in h264 (AV1 support is coming), so unsure why merely the change in fps would cause this bug.

I am going to also test 120 fps recordings using OBS to see if it could be a format issue with the way NVIDIA records, but either way this issue is still present in 100% of my testing.

mifi commented 4 months ago

Could you try to play the video in Chrome also and see if it’s the same?

Rytoxz commented 4 months ago

The 120 fps video has no issues being played anywhere outside of Lossless Cut. VLC, Discord, iOS player, Chromium embed all play seamlessly for me.

For reference, the first video in my original post is the raw 120 fps file. If you download it and open it in Lossless Cut you can view the behaviour.

I’ve been able to confirm this behaviour on other devices so can confirm that it’s not just specifically my PC. My main desktop has an RTX 4080 so I would assume there are no hardware acceleration issues here.

Edit: I have also checked 120 fps behaviour using OBS to record with both CBR and VBR. I can confirm the issue is the same. It seems LosslessCut has issues playing back videos at 120 frames per second.

mifi commented 4 months ago

That's strange. for me it plays smoothly at 120fps. i'm on m2 macbook air. which other devices did you try losslesscut on? do you see high cpu usage?

Rytoxz commented 4 months ago

I just managed to test on an M1 Macbook Air and can confirm I saw no issues either. This led me to consider whether display refresh rate would impact and in testing I have discovered the issue and the solution.

When using a VRR display, the convention is to enable V-sync and a global fps lock. The global fps lock applied to LosslessCut is what causes the issue. When I am capped to 141 fps, the playback stutters; when I am uncapped, the playback is smooth.

I will close the issue given the solution is external, though unsure whether you would consider it a bug still given the fps lock is higher than the playback framerate. An odd one for sure and hopefully this issue can be relevant for anyone else who faces this problem in the future.

mifi commented 4 months ago

interesting. so did all apps have global fps lock applied or only losslesscut? it's probably a bug in electron/windows/nvidia combination, and I have no idea how to fix it. maybe related: #922

Rytoxz commented 4 months ago

Yes, the max frame rate would apply to all 3D applications. Disabling this limit globally or specifically for LosslessCut resolves the issue.

image

It does seem linked to the other issue, as I have also reported other similar playback issues on Chromium browsers related to this setting: https://github.com/brave/brave-browser/issues/35307

Very likely a problem with Windows / Nvidia / Electron as you mentioned. Thank you for the help and input to lead to a resolution.