mirror of
https://github.com/chev2/shitpost-video-generator.git
synced 2026-04-22 02:32:41 +00:00
Further limit which audio sources can be duplicated
5 seconds -> 1 second, clips longer than this shouldn't be duplicated as they tend to overlap too much
This commit is contained in:
parent
2acdf266d6
commit
0271ff835c
1 changed files with 2 additions and 1 deletions
3
main.py
3
main.py
|
|
@ -171,7 +171,7 @@ with tqdm(desc="Compiling sounds", total=len(randomSounds)) as pbar:
|
|||
# the audio coming from the video clips
|
||||
newClip = newClip.with_volume_scaled(0.6)
|
||||
|
||||
if newClip.duration > 5: #for long clips
|
||||
if newClip.duration > 1:
|
||||
randomDuration = rng.uniform(*audio_clip_times) # crop audio duration
|
||||
# if the audio is longer than the cropped duration, crop the audio at a random position
|
||||
if newClip.duration > randomDuration:
|
||||
|
|
@ -181,6 +181,7 @@ with tqdm(desc="Compiling sounds", total=len(randomSounds)) as pbar:
|
|||
|
||||
newClip = newClip.with_start(rng.uniform(0, finalVideo.duration-newClip.duration)) # move audio around video length
|
||||
audioObjects.append(newClip)
|
||||
# only apply duplication to clips shorter than 1 second
|
||||
else:
|
||||
# Place to position the audio clip - could be anywhere from the final video's start all the way to its full duration
|
||||
clipPosition = rng.uniform(0, finalVideo.duration - newClip.duration)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue