LivePortrait icon indicating copy to clipboard operation
LivePortrait copied to clipboard

Audio/Video desync when framerate is not an integer

Open Max6mm opened this issue 10 months ago • 3 comments

When using a driving video with non integer framerate , 29.97 FPS in my case, LivePortrait round it to 29 FPS. It create an audio/video desync which become more important the longer the video is.

Max6mm avatar Feb 09 '25 17:02 Max6mm

A temporary solution is use change_video_fps to change the FPS of the original video to an interger, e.g., 30

https://github.com/KwaiVGI/LivePortrait/blob/7f755d93b6e120d5ab6bdc2f08d814b5b6935ad7/src/utils/video.py#L133-L135

cleardusk avatar Feb 16 '25 13:02 cleardusk

Also, you could edit the live_portrait_pipline.py file on lines 96 and 132 which cast the source and driving items FPS's to an integer. why? Good Question!

Change line 96 from: source_fps = int(get_fps(args.source)) to: source_fps = get_fps(args.source) Change line 132 from: output_fps = int(get_fps(args.driving)) to: output_fps = get_fps(args.driving)

I can only speculate on why the FPS was cast to an integer. But, after changing the code, LivePortrait works perfectly now with videos of any FPS rate.

I hope this helps.

tacitus-git avatar Mar 18 '25 02:03 tacitus-git

Thanks @tacitus-git for the solution

Max6mm avatar Jul 08 '25 12:07 Max6mm