initialize video and add title
This commit is contained in:
9
create_image.py
Normal file
9
create_image.py
Normal 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
|
||||
@@ -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
14
reddit.py
Normal 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
BIN
segments/output000.mp4
Normal file
Binary file not shown.
BIN
video_0.mp4
Normal file
BIN
video_0.mp4
Normal file
Binary file not shown.
Reference in New Issue
Block a user