[Python] I am trying to convert an video mp4 file to Audio mp3 format by using MoviePy module...

Discussão em 'Python' iniciado por Stack, Junho 27, 2025.

  1. Stack

    Stack Membro Participativo

    def download_audio():
    #try:
    b2.config(text="Please wait...")
    b2.config(state=DISABLED)
    stream = yt.streams.filter(res="480p")
    path = filedialog.askdirectory()
    if path == None:
    return
    stream[0].download(path)
    for i in os.listdir(path):
    os.rename(os.path.join(path,i),os.path.join(path,i.replace(' ','_')))
    title = yt.title.replace(' ','_')
    print(title)
    print(path)
    video = VideoFileClip(os.path.join(path+"//"+title+".mp4"))
    print(video)
    video.audio.write_audiofile(os.path.join(path+"//"+title+".mp3"))


    This is the Error message Attribute Error : NoneType object has no attribute write_audiofile

    Continue reading...

Compartilhe esta Página