Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync video duration to audio duration #96

Merged

Conversation

radry
Copy link
Contributor

@radry radry commented Feb 8, 2024

This fixes #42

I implemented a failsafe to ensure there is always enough video for the audio. No more still images or black images.

Following was changed:

search.py, main.py:
There is now a minimum duration for clips. (Default 10 seconds). Only longer clips will be accepted and downloaded.
This will reduce potential videos further but no worries because there is a failsafe and I increased the search results from 10 to 15.

video.py (combine_videos): The Failsafe
During clip combining it now calculates the remaning video length required to so that video and audio are the same length.
It will continue to add clips from the same downloaded ones until the video length matches the audio length.
Of course it will also check if a clip is too long and only add as much as needed to fill the audio length. It is perfectly matched.

Notes:
One downside that remains with this is that for long videos clips may be repeated BUT the ultimate goal is to have < 60 second videos anyway and with a minimum length of 10 seconds per clip and 5 clips (or increase to 6), it will never repeat. Thus this change will become only a failsafe.

Tested & works for me.

@FujiwaraChoki
Copy link
Owner

FujiwaraChoki commented Feb 8, 2024

Love goes out to you radry, always helping ❤️

@FujiwaraChoki FujiwaraChoki merged commit c983fd9 into FujiwaraChoki:main Feb 8, 2024
1 check passed
@radry radry deleted the Improve-video-clip-generation branch February 14, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Videoclips are too short for the actual script and stop at a still image.
2 participants