image_clip_with_audio.write_videofile(output_file, codec="libx264", fps=24)
I set the image clip's duration to the audio clip's duration. It works when the duration is some number between 2-3 seconds. MoviePY also generates a corrupted video when the duration is some number in between 2-3 seconds. I'm not sure what the specific duration between 2s and 3s that makes the video playable. I experimented with the encodings. When I set codec="mpeg4", the audio of the video plays, but the visuals do not appear. This leads me to believe it is an issue with the encoding. All videos 3 seconds or above, for instance, are all normal.