Created
December 10, 2022 01:37
-
-
Save tgreiser/0110ba9a662a15f403d793f71d2ef0be to your computer and use it in GitHub Desktop.
Make a seamless looping video from a normal video (colab)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assume you have out.mp4 that is a normal video | |
!ffmpeg -y -r 30 -i out.mp4 -vf reverse reversed.mp4 | |
!ffmpeg -y -i out.mp4 -i reversed.mp4 -filter_complex "concat=n=2:v=1:a=0" output.mp4 | |
print('\nSeamless loop (original saved to out.mp4):') | |
show_video('output.mp4') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to flex and do everything one line:
!ffmpeg -y -r 30 -i 'out_%*.png' -lavfi "split[x][y];[y]reverse[z];[x][z]concat" -crf 15 -preset veryslow -pix_fmt yuv420p out.mp4