Spaces:
Paused
Paused
ffmpeg video creation code changed
Browse files- Wav2Lip/video_generator.py +13 -2
Wav2Lip/video_generator.py
CHANGED
|
@@ -12,6 +12,7 @@ import platform
|
|
| 12 |
import torch
|
| 13 |
# import face_alignment
|
| 14 |
# import streamlit as st
|
|
|
|
| 15 |
|
| 16 |
# checkpoint_path = 'wav2lip_model/wav2lip_gan.tflite'
|
| 17 |
checkpoint_path = 'wav2lip_model/wav2lip_gan.pth'
|
|
@@ -269,6 +270,16 @@ def create_video(voice_audio, face):
|
|
| 269 |
|
| 270 |
out.release()
|
| 271 |
|
| 272 |
-
command = 'ffmpeg -y -i {} -i {} -strict -2 -q:v 1 {}'.format(voice_audio, 'temp/result.avi', outfile)
|
| 273 |
# subprocess.call(command, shell=platform.system() != 'Windows')
|
| 274 |
-
subprocess.call(command, shell=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
import torch
|
| 13 |
# import face_alignment
|
| 14 |
# import streamlit as st
|
| 15 |
+
import ffmpeg
|
| 16 |
|
| 17 |
# checkpoint_path = 'wav2lip_model/wav2lip_gan.tflite'
|
| 18 |
checkpoint_path = 'wav2lip_model/wav2lip_gan.pth'
|
|
|
|
| 270 |
|
| 271 |
out.release()
|
| 272 |
|
| 273 |
+
# command = 'ffmpeg -y -i {} -i {} -strict -2 -q:v 1 {}'.format(voice_audio, 'temp/result.avi', outfile)
|
| 274 |
# subprocess.call(command, shell=platform.system() != 'Windows')
|
| 275 |
+
# subprocess.call(command, shell=False)
|
| 276 |
+
|
| 277 |
+
# Replace args.audio and args.outfile with the actual variables or arguments
|
| 278 |
+
audio_input = voice_audio
|
| 279 |
+
video_input = 'temp/result.avi'
|
| 280 |
+
output_file = outfile
|
| 281 |
+
|
| 282 |
+
# Construct the ffmpeg command using ffmpeg-python
|
| 283 |
+
audio_stream = ffmpeg.input(audio_input)
|
| 284 |
+
video_stream = ffmpeg.input(video_input)
|
| 285 |
+
ffmpeg.concat(video_stream, audio_stream, v=1, a=1).output(output_file, strict='-2', qscale=1).run(overwrite_output=True)
|