I am using Moviepy to generate a new video from Python code. The purpose is to create a video that combines two TextClip objects, each displaying a different piece of text. Once executed, the code indeed produces an mp4 file. However, I am encountering an issue where I am unable to play the resulting video. When I attempt to open the file with Windows 11 Media Player, it displays an error with the code "0xc00d5212". This error is preventing me from verifying if the output video is as expected.
Here is the code I used:
from moviepy.editor import TextClip, concatenate_videoclips, CompositeVideoClip
jp_text = "こんにちは"
en_text = "Hello"
jp_clip = TextClip(jp_text, fontsize=24, color='white').set_duration(3)
en_clip = TextClip(en_text, fontsize=24, color='white').set_duration(3)
final_clip = concatenate_videoclips([jp_clip, en_clip])
final_clip.set_duration(6).set_fps(30).write_videofile("output.mp4")
To resolve the error, I tried a different approach, where I attempted to generate a webm video file instead of an mp4. I was able to play the resulting video, confirming that the code works in general. However, the output did not match my expectations as the image was incorrect.
The following is the code I tried:
final_clip.set_duration(6).set_fps(30).write_videofile("output.webm")
This is the resulting image: result
My expectation is to produce an mp4 video file that can be played back normally, with the correct images corresponding to the jp_clip and en_clip TextClips.