NickeManarin / ScreenToGif

🎬 ScreenToGif allows you to record a selected area of your screen, edit and save it as a gif or video.
http://www.screentogif.com
Microsoft Public License
23.21k stars 2.16k forks source link

FFmpeg importer drops any frames with unchanged pixels into the editor #1068

Open ParticleCore opened 2 years ago

ParticleCore commented 2 years ago

Describe the bug When importing an mp4 using the ffmpeg importer any unchanged frames are automatically dropped and there is no option to disable that behavior. When importing the same video using the mediaplayer importer, all frames are imported correctly, but the frame rate becomes really choppy/not as smooth as when importing with ffmpeg.

Note: I am not referring to when we save the video as a gif, but when we import it into the editor. Right away I can tell there are missing frames when I hit play in the editor.

To Reproduce Steps to reproduce the behavior:

A good video sample to test this with is a 30s recording of your desktop where nothing at all changes. When importing using the ffmpeg only 1 frame shows in the editor.

Open editor With the ffmpeg import an mp4 that has at least one period where no pixels change at all Press play in the editor The period with no pixels changed is gone Repeat the same process above but use the mediaplayer importer The period with no pixels changed is present, but the framerate is really bad

Expected behavior The importer should not be dropping frames arbitrarily

Desktop (please complete the following information):

Comments I don't know if the ffmpeg issue is normal and its the editor that is not adding the correct time to the frames that should represent the period where nothing changes in the video, and instead is putting the same short duration for all frames making it look like the unchanged pixels periods are missing. I mention this because that is what makes sense to me, the period with no pixels change at all should be represented by a single frame with a duration of that period.

NickeManarin commented 2 years ago

Hi, do you have a sample video so that I could test?

ParticleCore commented 2 years ago

I am not sure what is going on now, but the issue I reported originally appears to have changed to a different issue where the gif produced using FFmpeg is being slowed down even though I did not configure it to be slowed down.

When I imported the video I used these settings: image

And these are the settings I used for exporting the gif: image

This is the resulting GIF, it's apparently playing at half the speed despite not having configured it to do such thing: https://file.io/n6HCwU12XfNQ

This is the original video I used for this example: https://file.io/cdstlV1ZSazc

I had to upload them off site because they were bigger than the GitHub 10MB limit.

ParticleCore commented 2 years ago

By the way that was done using v2.37

ParticleCore commented 2 years ago

Seems like this new version basically ignores the frame times when exporting. I've tried multiple recordings and even reduced the time for all frames to the min possible (10ms) and after saving the gif it plays very slow, like 30ms per frame or so. I don't understand what is going on right now, and I tried different decoders.

ParticleCore commented 2 years ago

I was able to find the settings for the app and deleted them entirely after uninstalling the app and switched to the portable version, it is working correctly now. I do not understand what was happening in the settings before, but something was causing my problems there somehow.

ParticleCore commented 2 years ago

I was able to recover the deleted settings in case it might be useful to find why this issue was happening to me Settings - Copy.txt

ParticleCore commented 2 years ago

I believe the issue is with frame rates higher than 30fps. If I record using screentogif with the frame rate set to 60 then the slowness output occurs. It feels like when it is saving the recording into gif it is doubling the times based on the 60fps, instead of adjusting for that in the frames themselves, their own individual timings.

As a temporary workaround for this problem I have enabled "Fixed frame rate" in the recording settings, and now I am able to record and export in 60fps without the slowness problem.