0

I can't seem to get this video to download to my downloads folder, here is the code:

from tkinter import *
import tkinter.filedialog
import sounddevice as sd
import wavio as wv
from scipy.io.wavfile import write
from moviepy.editor import *
import os
import time

freq = 44100

app = Tk()
app.title("Voice Over")

header = Label(app, text="Voice Over", font=("arial",15))
header.pack(pady=5)

vid = ""

def choosevid():
    global vid
    vid = tkinter.filedialog.askopenfilename()
    vidout.config(text=vid)
    
vidbtn = Button(app, text="Choose Video", command=choosevid)
vidbtn.pack(pady=5)
    
vidout = Label(app, text="")
vidout.pack(pady=5)

def start():
    vide = VideoFileClip(vid)
    recording = sd.rec(int(round(vide.duration) * freq), samplerate=freq, channels=2)
    sd.wait()
    write("voiceover.mp3", freq, recording)
    video = VideoFileClip(vid)
    aud = AudioFileClip("voiceover.mp3")
    video.audio = aud
    video.write_videofile(os.environ['USERPROFILE']+"\\Downloads\\VoiceOver.mp4")
    os.system(os.environ['USERPROFILE']+"\\Downloads\\VoiceOver.mp4")
    
btn = Button(app, text="Start Recording", command=start)
btn.pack(pady=5)
    
out = Label(app, text="")
out.pack(pady=5)

app.mainloop()

Output: Moviepy - Building video C:\Users\15043\Downloads\VoiceOver.mp4. MoviePy - Writing audio in VoiceOverTEMP_MPY_wvf_snd.mp3

I've tried to change the audio different ways and saving it somewhere else and those didn't work either.

0 Answers0