0

I tried running simple moviepy code. It does not save anything. Exit code 0. No error message. No sucessfully saved print. I have the newest version of moviepy and ffmpeg. Doesnt work with or without specifying an output directory. I am on windows 10, working in PyCharm with Python 3.9 . I am super new to coding if it isnt obvious, thankful for any help!! Here is the code I used:

from moviepy.editor import VideoClip
from moviepy.video.io.ffmpeg_writer import FFMPEG_VideoWriter




    w, h = 640, 480
    red = int(255 * t)
    green = int(255 * (1 - t))
    blue = 0
    frame = np.zeros((h, w, 3), dtype=np.uint8)
    frame[:, :, 0] = red
    frame[:, :, 1] = green
    frame[:, :, 2] = blue
    return frame


duration = 5  # in seconds
fps = 30
width, height = 640, 480
video_clip = VideoClip(make_frame, duration=duration)


output_path = "output.mp4"


video_clip.write_videofile(output_path, fps=fps, codec='libx264')

print("File saved successfully!")

I was expecting to get any file saved at all. Nothing shows up in my folder. I have double checked MoviePy and ffmpeg as stated.

  • Please [edit] your question to explain what you are trying to achieve. You may have explained it to ChatGPT, but trying to piece together what your original instructions might have been from its output is not an efficient way to do this. – teapot418 May 27 '23 at 10:17
  • 1
    While you're at it, you may want to remove [banned content](https://meta.stackoverflow.com/questions/421831/temporary-policy-chatgpt-is-banned?cb=1) from your question as well. – teapot418 May 27 '23 at 10:17
  • @teapot418 thank you for getting back to quickly. I have read up on your links and adapted my question. I am focused on figuring out why MoviePy does not save a mp4 file as it is instructed to by the simple code posted. Thank you very much. – Paul Spieker May 27 '23 at 10:34
  • Try to use an absolute path because relative paths may not point to the expected location. – Michael Butscher May 27 '23 at 11:05

0 Answers0