Compare commits
No commits in common. "401203cd8384a044a3fd6d4b815800573cad4b1d" and "959d1f5408590ef9c1aa32cf17c01e012c533948" have entirely different histories.
401203cd83
...
959d1f5408
1 changed files with 5 additions and 8 deletions
13
edit.py
13
edit.py
|
@ -105,7 +105,7 @@ def get_pandora_media_path(oshash):
|
|||
|
||||
def cache_clips(api, videos, use_source=False, use_pandora=False):
|
||||
for clip in videos:
|
||||
if clip.get("titletext"):
|
||||
if clip.get("title"):
|
||||
continue
|
||||
out = '%s/%s.mp4' % (render, clip['oshash'])
|
||||
if 'path' in clip:
|
||||
|
@ -135,7 +135,7 @@ def make_title(title):
|
|||
width = 852
|
||||
height = 480
|
||||
image = Image.new("RGB", (width, height), "black")
|
||||
font = ImageFont.truetype("/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Bold.ttf", size=30)
|
||||
font = ImageFont.truetype("/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Regular.ttf", size=30)
|
||||
draw = ImageDraw.Draw(image)
|
||||
_, _, font_width, font_height = font.getbbox(title)
|
||||
new_width = (width - font_width) / 2
|
||||
|
@ -144,21 +144,18 @@ def make_title(title):
|
|||
image.save(title_png)
|
||||
cmd = [
|
||||
'ffmpeg', '-r', '25',
|
||||
'-hide_banner',
|
||||
'-nostats', '-loglevel', 'error', '-y',
|
||||
'-i', title_png, '-t', '5',
|
||||
'-pix_fmt', 'yuv420p',
|
||||
title_mp4
|
||||
]
|
||||
subprocess.call(cmd)
|
||||
clip = {
|
||||
"titletext": title,
|
||||
"title": title,
|
||||
"in": 0,
|
||||
"out": 5,
|
||||
"duration": 5,
|
||||
"volume": 1.0,
|
||||
"path": title_mp4,
|
||||
"oshash": ox.oshash(title_mp4),
|
||||
"path": title_mp4
|
||||
}
|
||||
return clip
|
||||
|
||||
|
@ -243,7 +240,7 @@ if __name__ == '__main__':
|
|||
if opts.title:
|
||||
clips.insert(0, make_title(opts.title))
|
||||
for clip in clips:
|
||||
if clip.get("titletext"):
|
||||
if clip.get("title"):
|
||||
videos.append(clip)
|
||||
position += clip['duration']
|
||||
position = math.ceil(position / (1/25)) * 1/25
|
||||
|
|
Loading…
Reference in a new issue