Update main.py
Browse files
main.py
CHANGED
@@ -91,7 +91,13 @@ async def create_slideshow(image_paths, audio_path, output_path, duration, zoom=
|
|
91 |
# Complex implementation with zoom effect
|
92 |
# Create a filter for each image that zooms in
|
93 |
filters = []
|
|
|
|
|
94 |
for i, img in enumerate(image_paths):
|
|
|
|
|
|
|
|
|
95 |
filter_str = f"[{i}:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,zoompan=z='min(zoom+0.0015,1.5)':d={duration*25}:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)',setpts=PTS-STARTPTS[v{i}];"
|
96 |
filters.append(filter_str)
|
97 |
|
@@ -99,6 +105,7 @@ async def create_slideshow(image_paths, audio_path, output_path, duration, zoom=
|
|
99 |
filter_complex = "".join(filters)
|
100 |
|
101 |
# Add concat to combine all zoompan videos
|
|
|
102 |
for i in range(len(image_paths)):
|
103 |
filter_complex += f"[v{i}]"
|
104 |
filter_complex += f"concat=n={len(image_paths)}:v=1:a=0[outv]"
|
|
|
91 |
# Complex implementation with zoom effect
|
92 |
# Create a filter for each image that zooms in
|
93 |
filters = []
|
94 |
+
inputs = []
|
95 |
+
|
96 |
for i, img in enumerate(image_paths):
|
97 |
+
# Add input for each image
|
98 |
+
inputs.extend(["-loop", "1", "-t", str(duration), "-i", img])
|
99 |
+
|
100 |
+
# Create zoom effect filter for each image
|
101 |
filter_str = f"[{i}:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,zoompan=z='min(zoom+0.0015,1.5)':d={duration*25}:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)',setpts=PTS-STARTPTS[v{i}];"
|
102 |
filters.append(filter_str)
|
103 |
|
|
|
105 |
filter_complex = "".join(filters)
|
106 |
|
107 |
# Add concat to combine all zoompan videos
|
108 |
+
filter_complex += ""
|
109 |
for i in range(len(image_paths)):
|
110 |
filter_complex += f"[v{i}]"
|
111 |
filter_complex += f"concat=n={len(image_paths)}:v=1:a=0[outv]"
|