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)
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
stdout, stdin = p.communicate()
|
stdout, stdin = p.communicate()
|
||||||
data = json.loads(stdout.decode())
|
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
|
return '%0.3f' % duration
|
||||||
|
|
||||||
for xml in sorted(glob('output/*/*.xml')):
|
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):
|
def sequence(seq, letter):
|
||||||
tags = KEYWORDS[letter]
|
tags = KEYWORDS[letter]
|
||||||
clips = {tag: get_clips(tag) for tag in tags}
|
clips = {tag: get_clips(tag) for tag in tags}
|
||||||
|
all_clips = clips.copy()
|
||||||
result = {
|
result = {
|
||||||
'clips': [],
|
'clips': [],
|
||||||
'text': [],
|
'text': [],
|
||||||
|
@ -195,10 +196,11 @@ def sequence(seq, letter):
|
||||||
|
|
||||||
max_duration = MAX_DURATION - duration
|
max_duration = MAX_DURATION - duration
|
||||||
clips_n = filter_clips(clips, n, max_duration)
|
clips_n = filter_clips(clips, n, max_duration)
|
||||||
tags_n = []
|
tags_n = [tag for tag in tags if tag in clips_n]
|
||||||
for tag in tags:
|
if not tags_n:
|
||||||
if tag in clips_n:
|
print('MISSING CLIPS, fall back to all clips!', letter, n)
|
||||||
tags_n.append(tag)
|
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:
|
if not tags_n:
|
||||||
print('NO tags for', letter, n)
|
print('NO tags for', letter, n)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -208,6 +210,10 @@ def sequence(seq, letter):
|
||||||
clip = random_choice(seq, clips_n[tag])
|
clip = random_choice(seq, clips_n[tag])
|
||||||
duration += clip['duration']
|
duration += clip['duration']
|
||||||
result['clips'].append(clip.copy())
|
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']:
|
for clip in result['clips']:
|
||||||
if seq() == 0:
|
if seq() == 0:
|
||||||
|
|
|
@ -86,6 +86,7 @@ for clip in data['clips']:
|
||||||
in_ = int(clip['in'] * fps)
|
in_ = int(clip['in'] * fps)
|
||||||
frames = int(clip['duration'] * fps)
|
frames = int(clip['duration'] * fps)
|
||||||
add_clip(video, clip['path'], in_, frames)
|
add_clip(video, clip['path'], in_, frames)
|
||||||
|
add_color(video, 'black', 60)
|
||||||
|
|
||||||
for clip in data['text']:
|
for clip in data['text']:
|
||||||
if clip.get('blank'):
|
if clip.get('blank'):
|
||||||
|
|
Loading…
Reference in a new issue