more changes

This commit is contained in:
Tanishq Dubey 2024-02-01 21:49:08 -05:00
parent ddb53c1111
commit 371d162c41
3 changed files with 6 additions and 2 deletions

View File

@ -5,7 +5,7 @@ def find_moving_average_highlights(short_ma, long_ma, scaling_factor=1):
in_a_clip = False
m = None
ret_list = []
for t in range(1, len(long_ma)):
for t in range(1, min(len(short_ma), len(long_ma))):
if (
not in_a_clip
and (short_ma[t - 1] < long_ma[t - 1])

View File

@ -4,6 +4,7 @@ import random
import tempfile
from dataclasses import dataclass
from pathlib import Path
import time
import numpy as np
import structlog
@ -151,6 +152,7 @@ class SentimentEditor:
best_large=large_window_center,
best_small=small_window_center,
duration=durations[index_min],
sp_multiplier=spread_multiplier,
)
if (
durations[index_min] > desired * 0.95
@ -168,7 +170,9 @@ class SentimentEditor:
spread_multiplier = spread_multiplier - spread_decay
if spread_multiplier < 0:
self.logger.warn("spread reached 0, resetting")
time.sleep(3)
large_window_center = random.uniform(30, 50)
small_window_center = random.uniform(5, 15)
spread_multiplier = random.uniform(0.15, 0.18)
spread_decay = random.uniform(0.0001, 0.001)
iterations = int(iterations / 2)

View File

@ -24,7 +24,7 @@ def render_moments(
iclip.resize(height=size[1])
clips.insert(0, iclip)
composite = mp.concatenate_videoclips(clips, method="compose")
composite.write_videofile(output_path, logger=None, threads=parallelism)
composite.write_videofile(output_path, audio_codec='aac', threads=parallelism)
def filter_moments(moments, min_length, max_length):