no reuse, black instead of white at end
This commit is contained in:
parent
326350f610
commit
fc51b9210f
3 changed files with 12 additions and 5 deletions
|
@ -17,7 +17,7 @@ def get_videoduration(video):
|
|||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, stdin = p.communicate()
|
||||
data = json.loads(stdout.decode())
|
||||
duration = float([s for s in data['streams'] if 'width' in s][0]['duration']) - 10/60
|
||||
duration = float([s for s in data['streams'] if 'width' in s][0]['duration']) - 70/60
|
||||
return '%0.3f' % duration
|
||||
|
||||
for xml in sorted(glob('output/*/*.xml')):
|
||||
|
|
14
render.py
14
render.py
|
@ -178,6 +178,7 @@ def filter_clips(clips, duration, max_duration=0):
|
|||
def sequence(seq, letter):
|
||||
tags = KEYWORDS[letter]
|
||||
clips = {tag: get_clips(tag) for tag in tags}
|
||||
all_clips = clips.copy()
|
||||
result = {
|
||||
'clips': [],
|
||||
'text': [],
|
||||
|
@ -195,10 +196,11 @@ def sequence(seq, letter):
|
|||
|
||||
max_duration = MAX_DURATION - duration
|
||||
clips_n = filter_clips(clips, n, max_duration)
|
||||
tags_n = []
|
||||
for tag in tags:
|
||||
if tag in clips_n:
|
||||
tags_n.append(tag)
|
||||
tags_n = [tag for tag in tags if tag in clips_n]
|
||||
if not tags_n:
|
||||
print('MISSING CLIPS, fall back to all clips!', letter, n)
|
||||
clips_n = filter_clips(all_clips, n, max_duration)
|
||||
tags_n = [tag for tag in tags if tag in clips_n]
|
||||
if not tags_n:
|
||||
print('NO tags for', letter, n)
|
||||
sys.exit(1)
|
||||
|
@ -208,6 +210,10 @@ def sequence(seq, letter):
|
|||
clip = random_choice(seq, clips_n[tag])
|
||||
duration += clip['duration']
|
||||
result['clips'].append(clip.copy())
|
||||
|
||||
# no reuse
|
||||
for t in clips:
|
||||
clips[t] = [c for c in clips[t] if not c['id'] == clip['id']]
|
||||
'''
|
||||
for clip in result['clips']:
|
||||
if seq() == 0:
|
||||
|
|
|
@ -86,6 +86,7 @@ for clip in data['clips']:
|
|||
in_ = int(clip['in'] * fps)
|
||||
frames = int(clip['duration'] * fps)
|
||||
add_clip(video, clip['path'], in_, frames)
|
||||
add_color(video, 'black', 60)
|
||||
|
||||
for clip in data['text']:
|
||||
if clip.get('blank'):
|
||||
|
|
Loading…
Reference in a new issue