CogVideo icon indicating copy to clipboard operation
CogVideo copied to clipboard

looping video

Open dribnet opened this issue 1 year ago • 6 comments

Feature request / 功能建议

Does anyone know if it is possible to force the video to loop seamlessly?

Motivation / 动机

Would be a great feature for posting short videos

Your contribution / 您的贡献

I might be able to implement this with some guidance would gladly contribute this back to the project.

dribnet avatar Aug 20 '24 03:08 dribnet

Could you describe it in more detail? Are you trying to extend the video by continuously generating 6-second segments and stitching them together into a longer video? :)

zRzRzRzRzRzRzR avatar Aug 20 '24 07:08 zRzRzRzRzRzRzR

Well - I meant something like this 😉

trimmed

If interested, I can try to clean this up a bit and submit it as a pull request as a pipeline option or maybe just a standalone demo using callback_on_step_end.

dribnet avatar Aug 20 '24 13:08 dribnet

That sounds interesting! Are you connecting the first and last frames of a video to create a 6-second looping animation? If so, I’d be happy to contribute a pull request (PR) as a tool! Looking forward to collaborating.

zRzRzRzRzRzRzR avatar Aug 21 '24 02:08 zRzRzRzRzRzRzR

If interested, I can try to clean this up a bit and submit it as a pull request as a pipeline option or maybe just a standalone demo using callback_on_step_end.

looks great! came looking for the same

screan avatar Sep 02 '24 06:09 screan

looks great! came looking for the same

Thanks - my version is a quick hack, but I cleaned it up a bit and pushed it to a with_looping branch in my fork in case anyone wants to use it as a starting point. There's a utility called cli_demo_loop.py that will create videos that more or less match at the beginning and end. Here's a few examples:

python cli_demo_loop.py --prompt "A couple are having dinner together." with_loop_02g

python cli_demo_loop.py --prompt "A woman is running on the beach in the late afternoon." with_loop_03g

python cli_demo_loop.py --prompt "A lion is drinking water." with_loop_06g

There's still some glitchiness at the seam and depending on the prompt you might get only an approximate match. For example:

python cli_demo_loop.py --prompt "A man is skiing." with_loop_04g

or it might not match at all and just insert a cut frame 🤷‍♂️

python cli_demo_loop.py --prompt "Nightfall in a metropolis." with_loop_05g

but when it does work it's pretty neat. I might come back to it and refine it or happy to discuss & improve it with anyone.

dribnet avatar Sep 04 '24 15:09 dribnet

https://github.com/feizc/CogvideX-Interpolation/tree/main?tab=readme-ov-file

rodjjo avatar Oct 17 '24 23:10 rodjjo