xinntao / Real-ESRGAN

Real-ESRGAN aims at developing Practical Algorithms for General Image/Video Restoration.
BSD 3-Clause "New" or "Revised" License
28.22k stars 3.55k forks source link

The frame count of the output video is less than the original one causing an audio desync #388

Open Maubry94 opened 2 years ago

Maubry94 commented 2 years ago

Hi! First your tool is incredible!

But I have one big problem: the result video has less frames than the original one causing an audio desync. Is there a way to fix that? An argument to preserve the frame count?

darkcristle commented 2 years ago

This is caused by how FFMPEG splits video. Most modern video encoding formats use key frames to denote time. So not every frame actually has a timestamp associated with it. Only keyframes. When the video is split it will split on the closest keyframe instead of on the exact frame. When the videos are reassembled at the end this results in some loss. My recommendation is to split the video before hand if you are using multi-processing and hard-code the inference to open those video files instead of splitting them itself. I used adobe premiere pro to do this but any video editing software should be able to.

Emanuelcarvalho2004 commented 2 years ago

🙃