Compare commits
2 commits
959d1f5408
...
401203cd83
Author | SHA1 | Date | |
---|---|---|---|
401203cd83 | |||
d271e9ba32 |
1 changed files with 8 additions and 5 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("title"):
|
||||
if clip.get("titletext"):
|
||||
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-Regular.ttf", size=30)
|
||||
font = ImageFont.truetype("/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Bold.ttf", size=30)
|
||||
draw = ImageDraw.Draw(image)
|
||||
_, _, font_width, font_height = font.getbbox(title)
|
||||
new_width = (width - font_width) / 2
|
||||
|
@ -144,18 +144,21 @@ 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 = {
|
||||
"title": title,
|
||||
"titletext": title,
|
||||
"in": 0,
|
||||
"out": 5,
|
||||
"duration": 5,
|
||||
"volume": 1.0,
|
||||
"path": title_mp4
|
||||
"path": title_mp4,
|
||||
"oshash": ox.oshash(title_mp4),
|
||||
}
|
||||
return clip
|
||||
|
||||
|
@ -240,7 +243,7 @@ if __name__ == '__main__':
|
|||
if opts.title:
|
||||
clips.insert(0, make_title(opts.title))
|
||||
for clip in clips:
|
||||
if clip.get("title"):
|
||||
if clip.get("titletext"):
|
||||
videos.append(clip)
|
||||
position += clip['duration']
|
||||
position = math.ceil(position / (1/25)) * 1/25
|
||||
|
|
Loading…
Reference in a new issue