Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import glob
- from moviepy.editor import *
- from PIL import Image
- mp3_files = glob.glob("CommenturileAudio/*.mp3")
- png_files = glob.glob("CommentPhotos/*.png")
- #video = VideoFileClip('test.mp4')
- mp3_file = glob.glob('CommenturileAudio/*.mp3')
- mp3_durations = glob.glob('Duration/*.txt')
- files = 0
- img_from_folder = []
- durations = []
- def size_checker():
- for img in png_files:
- image = Image.open(img)
- width, height = image.size
- #print("Marimea este: {} {}".format(width, height))
- #size_checker
- def add_img():
- global png_files
- global img_from_folder
- for file in png_files:
- img_from_folder.append(file)
- def get_durations():
- global durations
- for file in mp3_durations:
- with open(file, 'r') as f:
- file_content = f.read()
- durations.append(int(float((file_content))))
- #print(file_content)
- add_img()
- get_durations()
- audio_clip = [AudioFileClip(n)
- for n in mp3_files]
- clips = ImageSequenceClip(img_from_folder, durations=durations)
- clips.write_images_sequence('xzsdscdsd.mp4', fps=24)
- #concat_clip = concatenate_videoclips(clips, method="compose")
- #new_audio = concatenate_audioclips(audio_clip)
- #concat_clip.audio = new_audio
- #concat_clip.write_videofile('test.mp4', fps=24)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement