Audio/Video desync when framerate is not an integer
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.
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
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.
Thanks @tacitus-git for the solution