Python 视频制作者
Python video maker
我使用Python制作了这个将图像转换为视频的脚本。
问题:
当我 运行 显示空白屏幕时。
这是代码(使用 tkinter 和 moviepy):
from moviepy.editor import *
from tkinter import *
from tkinter.ttk import *
from tkinter import Tk
from tkinter.filedialog import askopenfilename
from tkinter import Tk
root = Tk()
print("-----Welcome to photo video maker by Adhi-----")
#1----------------------------------------------------------------
a =("Enter the name of image 1: ")
img1 = input(a)
#2----------------------------------------------------------------
b =("Enter the name of image 2: ")
img2 = input(b)
#3................................................................
c =("Enter the name of image 3: ")
img3 = input(c)
#--------------------------------
Duration=input("Enter video duration: ")
name=input("Enter new video name: ")
#############################################################################
def b1():
img = [img1, img2, img3]
clips = [ImageClip(m).set_duration(duration)
for m in img]
concat_clip = concatenate_videoclips(clips, method="compose")
concat_clip.write_videofile(name, fps=50)
btn = Button(root, text = 'Start', command = img)
btn.pack(side = 'top')
root.mainloop()
答案很简单。稍等片刻,您的代码就会生效。
我使用Python制作了这个将图像转换为视频的脚本。
问题: 当我 运行 显示空白屏幕时。
这是代码(使用 tkinter 和 moviepy):
from moviepy.editor import *
from tkinter import *
from tkinter.ttk import *
from tkinter import Tk
from tkinter.filedialog import askopenfilename
from tkinter import Tk
root = Tk()
print("-----Welcome to photo video maker by Adhi-----")
#1----------------------------------------------------------------
a =("Enter the name of image 1: ")
img1 = input(a)
#2----------------------------------------------------------------
b =("Enter the name of image 2: ")
img2 = input(b)
#3................................................................
c =("Enter the name of image 3: ")
img3 = input(c)
#--------------------------------
Duration=input("Enter video duration: ")
name=input("Enter new video name: ")
#############################################################################
def b1():
img = [img1, img2, img3]
clips = [ImageClip(m).set_duration(duration)
for m in img]
concat_clip = concatenate_videoclips(clips, method="compose")
concat_clip.write_videofile(name, fps=50)
btn = Button(root, text = 'Start', command = img)
btn.pack(side = 'top')
root.mainloop()
答案很简单。稍等片刻,您的代码就会生效。