1

I'm tring to add an audio file to a video file. When it has finished, I use the 'write_videofile()' function in moviepy. I use a string to save the filename, but when my code runs, here comes an exception:TypeError:must be real number, not NoneType

here is my code:

...
from moviepy.editor import *
...

class Recorder():
    def __init__(self):
        self.currentTime = time.localtime()
        self.outputName = "videos/{}.mp4".format(time.strftime("%Y%m%d-%H%M%S",self.currentTime))
        self.videoName = "videos/{}.avi".format(time.strftime("%Y%m%d-%H%M%S",self.currentTime))
    ...
    def merge(self):
        ...
        print(type(self.outputName)) # this outputs "<class 'str'>"
        video.write_videofile(self.outputName) # TypeError:must be real number, not NoneType
        ...

...
xzx7131
  • 23
  • 6
  • This question has been asked before. Try solutions from https://stackoverflow.com/questions/68032884/getting-typeerror-must-be-real-number-not-nonetype-whenever-trying-to-run-wr – Adid Jan 02 '22 at 06:56

0 Answers0