Search code examples
pythonvideovideo-encoding

Python video maker


I made this script for converting images to video using Python.

Problem: When I run this it is showing a blank screen.

Here is the code (uses tkinter and 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()

Solution

  • The answer for this is simple. Just wait for a minute and your code will be working.