initialize video and add title

This commit is contained in:
2024-04-06 19:20:17 -07:00
parent 1357f9f081
commit 9507f92b27
11 changed files with 52 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

9
create_image.py Normal file
View File

@@ -0,0 +1,9 @@
from PIL import Image, ImageDraw, ImageFont
def reddit(img, title):
i = Image.open(img)
d = ImageDraw.Draw(i)
d.text((28, 36), title, fill=(255, 0, 0))
# fnt = ImageFont.truetype('Pillow/Tests/fonts/FreeMono.ttf', 40)
i.save(fp=i+'.png')
return True

BIN
ffmpeg Executable file

Binary file not shown.

BIN
image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
out.mp4 Normal file

Binary file not shown.

BIN
out2.mp4 Normal file

Binary file not shown.

View File

@@ -1,2 +1,31 @@
import ffmpeg
def add_title(iv, ii):
(
ffmpeg
.input(iv)
.overlay(ffmpeg.input(ii), x=0, y=420)
.output('out2.mp4')
.run(cmd='./ffmpeg', overwrite_output=True)
)
# vid = ffmpeg.input(iv)
# pic = ffmpeg.input(ii)
# vid = ffmpeg.overlay(vid, pic)
# vid = ffmpeg.output('out.mp4')
# vid = ffmpeg.run(vid)
# add_title(iv='out.mp4', ii='image.png')
def initialize_video(iv, t):
(
ffmpeg
.input(iv)
.filter("crop", f"ih*({1080}/{1920})", f"iw*({1080}/{1920})")
.output(segment_time='1', f='segment', reset_timestamps='1', filename=f'segments/output%03d.mp4')
.run(cmd='./ffmpeg', overwrite_output=True)
)
initialize_video('video.mp4', 1)
add_title('out.mp4', 'image.png')
ffmpeg.output

14
reddit.py Normal file
View File

@@ -0,0 +1,14 @@
import praw
reddit = praw.Reddit(
client_id="my client id",
client_secret="my client secret",
user_agent="my user agent",
)
def get_posts():
ids = []
for submission in reddit.subreddit("news").new(limit=10):
ids.append(submission.id)
return ids

BIN
segments/output000.mp4 Normal file

Binary file not shown.

BIN
video.mp4 Normal file

Binary file not shown.

BIN
video_0.mp4 Normal file

Binary file not shown.