Spaces:
Running
Running
import subprocess,platform | |
from pydub import AudioSegment | |
input_audio_path_and_name = "room-ambience.wav" | |
input_video_path_and_name = "ref_videos/Liv.mp4" | |
output_video_path_and_name= "Liv_room_ambience.mp4" | |
sound = AudioSegment.from_mp3("room-ambience.mp3") | |
# Get the duration in seconds | |
sound_duration = sound.duration_seconds | |
print("sound_duration"+str(sound_duration)) | |
sound.export("room-ambience.wav", format="wav") | |
command = 'ffmpeg -y -i {} -i {} -strict -2 -q:v 1 -shortest {}'.format(input_audio_path_and_name, input_video_path_and_name, | |
output_video_path_and_name) | |
subprocess.call(command, shell=platform.system() != 'Windows') |