habulaj commited on
Commit
1be0689
·
verified ·
1 Parent(s): 49850f1

Update detect_crop_video.py

Browse files
Files changed (1) hide show
  1. detect_crop_video.py +11 -7
detect_crop_video.py CHANGED
@@ -237,7 +237,7 @@ def check_nvenc_support():
237
  return False
238
 
239
 
240
- def detect_and_crop_video(video_path, output_video_path):
241
  """
242
  Detecta a região com movimento no vídeo e gera um vídeo cropado.
243
  Retorna True se o crop foi realizado, False caso contrário.
@@ -380,13 +380,17 @@ def detect_and_crop_video(video_path, output_video_path):
380
  return False
381
 
382
  if crop_success:
383
- # Pass 2: Text crop
384
- print("🔄 Iniciando verificação de texto para segundo crop...")
385
- text_cropped = detect_and_crop_text(tmp_output_path, output_video_path)
386
- if not text_cropped:
 
 
 
 
 
 
387
  shutil.move(tmp_output_path, output_video_path)
388
- elif os.path.exists(tmp_output_path):
389
- os.remove(tmp_output_path)
390
  return True
391
 
392
  return False
 
237
  return False
238
 
239
 
240
+ def detect_and_crop_video(video_path, output_video_path, text_cut=True):
241
  """
242
  Detecta a região com movimento no vídeo e gera um vídeo cropado.
243
  Retorna True se o crop foi realizado, False caso contrário.
 
380
  return False
381
 
382
  if crop_success:
383
+ if text_cut:
384
+ # Pass 2: Text crop
385
+ print("🔄 Iniciando verificação de texto para segundo crop...")
386
+ text_cropped = detect_and_crop_text(tmp_output_path, output_video_path)
387
+ if not text_cropped:
388
+ shutil.move(tmp_output_path, output_video_path)
389
+ elif os.path.exists(tmp_output_path):
390
+ os.remove(tmp_output_path)
391
+ else:
392
+ print("⏩ Pulando verificação OCR por configuração do usuário (text_cut=False).")
393
  shutil.move(tmp_output_path, output_video_path)
 
 
394
  return True
395
 
396
  return False