Spaces:
Running
Running
File size: 702 Bytes
37b0a15 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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') |