mirror of
https://github.com/Paillat-dev/viralfactory.git
synced 2026-01-03 01:34:54 +00:00
🐛 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:
@@ -6,5 +6,5 @@ from moviepy.editor import VideoClip
|
||||
|
||||
class BaseBackgroundEngine(BaseEngine):
|
||||
@abstractmethod
|
||||
def get_background(self) -> VideoClip:
|
||||
def get_background(self) -> None:
|
||||
...
|
||||
|
||||
@@ -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
|
||||
@@ -1,2 +1,2 @@
|
||||
from .BaseBackgroundEngine import BaseBackgroundEngine
|
||||
from .SimpleBackgroundEngine import SimpleBackgroundEngine
|
||||
from .VideoBackgroundEngine import VideoBackgroundEngine
|
||||
|
||||
Reference in New Issue
Block a user