saq1b commited on
Commit
87ea35b
·
verified ·
1 Parent(s): e1c9abe

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -3
main.py CHANGED
@@ -88,19 +88,23 @@ async def create_slideshow(image_paths, audio_path, output_path, duration, zoom=
88
  output_path
89
  ]
90
  else:
91
- # ffmpeg -loop 1 -framerate 60 -i image.jpg -vf "scale=8000:-1,zoompan=z='zoom+0.001':x=iw/2-(iw/zoom/2):y=ih/2-(ih/zoom/2):d=5*60:s=1920x1280:fps=60" -t 5 -c:v libx264 -pix_fmt yuv420p output.mp4
92
  # For zoom effect, process each image separately and then concatenate
93
  temp_videos = []
94
- zoom_filter = f"zoompan=z='min(zoom+{zoom_ratio},1.5)':x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':d={duration*60}:s=1920x1080:fps=24"
95
-
 
 
96
  # First create individual video clips with zoom effect for each image
97
  for i, img_path in enumerate(image_paths):
98
  temp_video = os.path.join(os.path.dirname(output_path), f"temp_{i:03d}.mp4")
99
  temp_videos.append(temp_video)
100
 
 
 
101
  img_cmd = [
102
  "ffmpeg",
103
  "-loop", "1",
 
104
  "-i", img_path,
105
  "-vf", zoom_filter,
106
  "-t", str(duration),
 
88
  output_path
89
  ]
90
  else:
 
91
  # For zoom effect, process each image separately and then concatenate
92
  temp_videos = []
93
+ # Enhanced zoom effect with higher resolution scaling and smoother motion
94
+ framerate = 60
95
+ output_res = "1920x1080"
96
+
97
  # First create individual video clips with zoom effect for each image
98
  for i, img_path in enumerate(image_paths):
99
  temp_video = os.path.join(os.path.dirname(output_path), f"temp_{i:03d}.mp4")
100
  temp_videos.append(temp_video)
101
 
102
+ zoom_filter = f"scale=8000:-1,zoompan=z='min(zoom+0.001,1.5)':x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':d={duration*framerate}:s={output_res}:fps={framerate}"
103
+
104
  img_cmd = [
105
  "ffmpeg",
106
  "-loop", "1",
107
+ "-framerate", str(framerate),
108
  "-i", img_path,
109
  "-vf", zoom_filter,
110
  "-t", str(duration),