From d271e9ba323ddcd429a2d6685654b472f0a8df21 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 22 May 2024 10:53:21 +0200 Subject: [PATCH 1/2] use titletext, title already used --- edit.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/edit.py b/edit.py index 76ed945..144aaf6 100755 --- a/edit.py +++ b/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: @@ -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 From 401203cd8384a044a3fd6d4b815800573cad4b1d Mon Sep 17 00:00:00 2001 From: j Date: Wed, 22 May 2024 11:04:18 +0200 Subject: [PATCH 2/2] use bold --- edit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edit.py b/edit.py index 144aaf6..973c20b 100755 --- a/edit.py +++ b/edit.py @@ -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