trannam1084 commited on
Commit
bb48488
·
verified ·
1 Parent(s): 5c15472

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -337,10 +337,10 @@ def process_video(
337
  sv.process_video(
338
  source_path=video_path,
339
  target_path=output_path,
340
- callback=callback
341
  )
342
 
343
- # Re-encode sang H.264 để video dễ xem / tải về trên web
344
  final_path = output_path.replace(".mp4", "_h264.mp4")
345
  try:
346
  import imageio_ffmpeg
@@ -371,10 +371,7 @@ def process_video(
371
  stdout=subprocess.DEVNULL,
372
  stderr=subprocess.DEVNULL,
373
  )
374
- try:
375
- os.remove(output_path)
376
- except OSError:
377
- pass
378
  output_path = final_path
379
 
380
  return output_path
 
337
  sv.process_video(
338
  source_path=video_path,
339
  target_path=output_path,
340
+ callback=callback,
341
  )
342
 
343
+ # Re-encode sang H.264 để trình duyệt đọc đúng metadata (tránh NaN:NaN)
344
  final_path = output_path.replace(".mp4", "_h264.mp4")
345
  try:
346
  import imageio_ffmpeg
 
371
  stdout=subprocess.DEVNULL,
372
  stderr=subprocess.DEVNULL,
373
  )
374
+ os.remove(output_path)
 
 
 
375
  output_path = final_path
376
 
377
  return output_path