saq1b commited on
Commit
8941369
·
verified ·
1 Parent(s): 6f61fa6

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -99,9 +99,9 @@ async def create_slideshow(image_paths, audio_path, output_path, duration, zoom=
99
  filter_complex = ""
100
  for i in range(len(image_paths)):
101
  # Each input's video stream is processed with zoompan.
102
- # The zoom increases by zoom_ratio per frame (starting at 1.0).
103
  filter_complex += (
104
- f"[{i}:v]zoompan=z='if(eq(on,0),1,zoom+{zoom_ratio})':"
105
  f"d={duration*fps}:s=hd720, setpts=PTS-STARTPTS[v{i}];"
106
  )
107
  # Concatenate all processed video segments.
@@ -127,7 +127,7 @@ async def create_slideshow(image_paths, audio_path, output_path, duration, zoom=
127
  stdout=asyncio.subprocess.PIPE,
128
  stderr=asyncio.subprocess.PIPE
129
  )
130
- stdout, stderr = await process.communicate()
131
 
132
  # Remove temporary concat file if it exists
133
  if not zoom and os.path.exists("temp_concat.txt"):
 
99
  filter_complex = ""
100
  for i in range(len(image_paths)):
101
  # Each input's video stream is processed with zoompan.
102
+ # The zoom increases by zoom_ratio per frame (starting at 1.0) and centers the image.
103
  filter_complex += (
104
+ f"[{i}:v]zoompan=z='if(eq(on,0),1,zoom+{zoom_ratio})':x='iw/2-(iw/zoom)/2':y='ih/2-(ih/zoom)/2':"
105
  f"d={duration*fps}:s=hd720, setpts=PTS-STARTPTS[v{i}];"
106
  )
107
  # Concatenate all processed video segments.
 
127
  stdout=asyncio.subprocess.PIPE,
128
  stderr=asyncio.subprocess.PIPE
129
  )
130
+ _, stderr = await process.communicate()
131
 
132
  # Remove temporary concat file if it exists
133
  if not zoom and os.path.exists("temp_concat.txt"):