artificialguybr commited on
Commit
806257e
β€’
1 Parent(s): f9ac62d

Update Wav2Lip/inference.py

Browse files
Files changed (1) hide show
  1. Wav2Lip/inference.py +7 -0
Wav2Lip/inference.py CHANGED
@@ -8,6 +8,9 @@ import torch, face_detection
8
  from models import Wav2Lip
9
  import platform
10
 
 
 
 
11
  parser = argparse.ArgumentParser(description='Inference code to lip-sync videos in the wild using Wav2Lip models')
12
 
13
  parser.add_argument('--checkpoint_path', type=str,
@@ -246,6 +249,10 @@ def main():
246
  batch_size = args.wav2lip_batch_size
247
  gen = datagen(full_frames.copy(), mel_chunks)
248
 
 
 
 
 
249
  for i, (img_batch, mel_batch, frames, coords) in enumerate(tqdm(gen,
250
  total=int(np.ceil(float(len(mel_chunks))/batch_size)))):
251
  if i == 0:
 
8
  from models import Wav2Lip
9
  import platform
10
 
11
+ if not os.path.exists('temp'):
12
+ os.makedirs('temp')
13
+
14
  parser = argparse.ArgumentParser(description='Inference code to lip-sync videos in the wild using Wav2Lip models')
15
 
16
  parser.add_argument('--checkpoint_path', type=str,
 
249
  batch_size = args.wav2lip_batch_size
250
  gen = datagen(full_frames.copy(), mel_chunks)
251
 
252
+ if not out.isOpened():
253
+ print("Error: VideoWriter didn't open successfully.")
254
+ return
255
+
256
  for i, (img_batch, mel_batch, frames, coords) in enumerate(tqdm(gen,
257
  total=int(np.ceil(float(len(mel_chunks))/batch_size)))):
258
  if i == 0: