HomeiOS Developmentios - I obtained MoviePy Error: creation of None failed due to...

ios – I obtained MoviePy Error: creation of None failed due to the next error,How can resolve this points


Right here is my code:

import cv2
import numpy as np
from PIL import ImageFont, ImageDraw, Picture
from moviepy.editor import VideoFileClip, TextClip, 
CompositeVideoClip

os.environ["IMAGEMAGICK_BINARY"] = r"C:/Program Information/ImageMagick-7.1.1-Q16-HDRI/magick.exe"

def create_video_with_typewriter_effect(textual content, output_filename, fontsize=30, video_fps=30):
 # Load your video
 video = VideoFileClip("D:/video.mp4")
 video = video.subclip(0, 2)  # Trim the video if wanted

 # Get video dimensions
 video_width = video.w
 video_height = video.h
 video_size = (video_width, video_height)

 # Create a TextClip for your complete textual content
 font="Arial-Daring"
 text_clip = TextClip(textual content, fontsize=fontsize, font=font, colour="white")

 # Calculate the variety of frames for the typing impact
 num_frames = int(video.period * video_fps)

 # Initialize a listing to retailer every body
 frames = []

 # Create particular person frames for the typing impact
 for frame_idx in vary(num_frames):
    body = np.zeros((video_height, video_width, 3), dtype=np.uint8)
    frame_pil = Picture.fromarray(body)
    draw = ImageDraw.Draw(frame_pil)

    current_text = textual content[:int(len(text) * frame_idx / num_frames)]
    text_clip = TextClip(current_text, fontsize=fontsize, font=font, colour="white")
    text_clip = text_clip.set_duration(1 / video_fps)
    text_clip = text_clip.set_position(("heart", "heart"))
    text_clip = text_clip.set_start(frame_idx / video_fps)
    frames.append(text_clip.get_frame(frame_idx / video_fps))

# Composite the frames over the video
typewriter_video = CompositeVideoClip([video.set_duration(video.duration), *frames])

# Write the ultimate video to the output file
typewriter_video.write_videofile(output_filename, codec="libx264", fps=video_fps)


textual content = "Historical Ruins and Storied Historical past Journey by Sri Lanka's Cultural Triangle"
output_filename = "D:/output_video.mp4"
create_video_with_typewriter_effect(textual content, output_filename)

Error that i obtained:

OSError: MoviePy Error: creation of None failed due to the next error:

convert.exe: label anticipated @C:UsershpAppDataLocalTemptmprpxltnkj.txt' @ error/annotate.c/GetMultilineTypeMetrics/804. convert.exe: no pictures outlined PNG32:C:UsershpAppDataLocalTemptmpaf7s7kpu.png’ @ error/convert.c/ConvertImageCommand/3362.
.

.This error could be on account of the truth that ImageMagick just isn’t put in in your laptop, or (for Home windows customers) that you just did not specify the trail to the ImageMagick binary in file conf.py, or that the trail you specified is inaccurate

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments