🐛 fix(GenerationContext.py): fix indentation issue in process() method

 feat(GenerationContext.py): add support for z-index of moviepy clips to improve video rendering
The indentation issue in the process() method has been fixed. The z-index of moviepy clips has been added to improve the rendering of the video. This allows the clips to be rendered in different layers based on their index, resulting in a more visually appealing video.
This commit is contained in:
2024-02-21 09:06:36 +01:00
parent cced96d792
commit bd00a49063
17 changed files with 75 additions and 66 deletions

View File

@@ -6,5 +6,5 @@ from moviepy.editor import VideoClip
class BaseBackgroundEngine(BaseEngine):
@abstractmethod
def get_background(self) -> VideoClip:
def get_background(self) -> None:
...

View File

@@ -10,7 +10,7 @@ from moviepy.video.fx.crop import crop
from . import BaseBackgroundEngine
class SimpleBackgroundEngine(BaseBackgroundEngine):
class VideoBackgroundEngine(BaseBackgroundEngine):
name = "SImple Background Engine"
description = "A basic background engine to set the background of the video from a local file."
num_options = 1
@@ -48,12 +48,14 @@ class SimpleBackgroundEngine(BaseBackgroundEngine):
start = random.uniform(0, background_max_start)
clip = background.subclip(start, start + self.ctx.duration)
w, h = clip.size
return crop(
clip,
width=self.ctx.width,
height=self.ctx.height,
x_center=w / 2,
y_center=h / 2,
self.ctx.index_0.append(
crop(
clip,
width=self.ctx.width,
height=self.ctx.height,
x_center=w / 2,
y_center=h / 2,
)
)
@classmethod

View File

@@ -1,2 +1,2 @@
from .BaseBackgroundEngine import BaseBackgroundEngine
from .SimpleBackgroundEngine import SimpleBackgroundEngine
from .VideoBackgroundEngine import VideoBackgroundEngine