charbelgrower commited on
Commit
31fe0f3
1 Parent(s): 97162c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -237,7 +237,7 @@ def process_video(source_path: str, target_path: str, enhance = False, progress=
237
  '-i', temp_frames_pattern,
238
  '-c:v', 'libx264',
239
  '-pix_fmt', 'yuv420p',
240
- '-preset', 'ultrafast',
241
  output_video_path
242
  ]
243
 
@@ -251,7 +251,7 @@ def process_video(source_path: str, target_path: str, enhance = False, progress=
251
  '-i', video_path,
252
  '-q:a', '0',
253
  '-map', 'a',
254
- '-preset', 'ultrafast',
255
  audio_path
256
  ]
257
 
@@ -266,7 +266,7 @@ def process_video(source_path: str, target_path: str, enhance = False, progress=
266
  '-c:v', 'copy',
267
  '-c:a', 'aac',
268
  '-strict', 'experimental',
269
- '-preset', 'ultrafast',
270
  output_video_path
271
  ]
272
 
@@ -280,7 +280,15 @@ def process_video(source_path: str, target_path: str, enhance = False, progress=
280
  print(f"Erro ao remover o arquivo: {e}")
281
 
282
  def reduce_video(video_path: str, output_video_path: str) -> None:
283
- print('high')
 
 
 
 
 
 
 
 
284
 
285
  temp_dir = create_temp_directory()
286
  video_input = temp_dir + "/input.mp4"
 
237
  '-i', temp_frames_pattern,
238
  '-c:v', 'libx264',
239
  '-pix_fmt', 'yuv420p',
240
+ '-preset', 'normal',
241
  output_video_path
242
  ]
243
 
 
251
  '-i', video_path,
252
  '-q:a', '0',
253
  '-map', 'a',
254
+ '-preset', 'normal',
255
  audio_path
256
  ]
257
 
 
266
  '-c:v', 'copy',
267
  '-c:a', 'aac',
268
  '-strict', 'experimental',
269
+ '-preset', 'normal',
270
  output_video_path
271
  ]
272
 
 
280
  print(f"Erro ao remover o arquivo: {e}")
281
 
282
  def reduce_video(video_path: str, output_video_path: str) -> None:
283
+ ffmpeg_command = [
284
+ 'ffmpeg',
285
+ '-y',
286
+ '-i', video_path,
287
+ '-vf', "scale='if(gte(iw,ih),720,-1)':'if(gte(iw,ih),-1,720)',pad=ceil(iw/2)*2:ceil(ih/2)*2",
288
+ '-preset', 'normal',
289
+ output_video_path
290
+ ]
291
+ subprocess.run(ffmpeg_command, check=True)
292
 
293
  temp_dir = create_temp_directory()
294
  video_input = temp_dir + "/input.mp4"