|
|
@ -6,7 +6,7 @@ from pathlib import Path
|
|
|
|
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
|
|
|
|
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
|
|
|
|
from moviepy.editor import VideoFileClip
|
|
|
|
from moviepy.editor import VideoFileClip
|
|
|
|
from utils.console import print_step, print_substep
|
|
|
|
from utils.console import print_step, print_substep
|
|
|
|
|
|
|
|
from moviepy.video.io.VideoFileClip import VideoFileClip
|
|
|
|
|
|
|
|
|
|
|
|
def get_start_and_end_times(video_length, length_of_clip):
|
|
|
|
def get_start_and_end_times(video_length, length_of_clip):
|
|
|
|
|
|
|
|
|
|
|
@ -42,10 +42,9 @@ def chop_background_video(video_length):
|
|
|
|
background = VideoFileClip("assets/mp4/background.mp4")
|
|
|
|
background = VideoFileClip("assets/mp4/background.mp4")
|
|
|
|
|
|
|
|
|
|
|
|
start_time, end_time = get_start_and_end_times(video_length, background.duration)
|
|
|
|
start_time, end_time = get_start_and_end_times(video_length, background.duration)
|
|
|
|
ffmpeg_extract_subclip(
|
|
|
|
|
|
|
|
"assets/mp4/background.mp4",
|
|
|
|
with VideoFileClip("assets/mp4/background.mp4") as video:
|
|
|
|
start_time,
|
|
|
|
new = video.subclip(start_time, end_time)
|
|
|
|
end_time,
|
|
|
|
new.write_videofile("assets/mp4/clip.mp4")
|
|
|
|
targetname="assets/mp4/clip.mp4",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
print_substep("Background video chopped successfully!", style="bold green")
|
|
|
|
print_substep("Background video chopped successfully!", style="bold green")
|
|
|
|