Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. import glob
  2.  
  3. from moviepy.editor import *
  4.  
  5. from PIL import Image
  6.  
  7.  
  8. mp3_files = glob.glob("CommenturileAudio/*.mp3")
  9.  
  10. png_files = glob.glob("CommentPhotos/*.png")
  11.  
  12. #video = VideoFileClip('test.mp4')
  13.  
  14. mp3_file = glob.glob('CommenturileAudio/*.mp3')
  15.  
  16. mp3_durations = glob.glob('Duration/*.txt')
  17.  
  18. files = 0
  19.  
  20. img_from_folder = []
  21. durations = []
  22. def size_checker():
  23. for img in png_files:
  24. image = Image.open(img)
  25. width, height = image.size
  26. #print("Marimea este: {} {}".format(width, height))
  27. #size_checker
  28. def add_img():
  29. global png_files
  30. global img_from_folder
  31. for file in png_files:
  32. img_from_folder.append(file)
  33. def get_durations():
  34. global durations
  35. for file in mp3_durations:
  36. with open(file, 'r') as f:
  37. file_content = f.read()
  38. durations.append(int(float((file_content))))
  39. #print(file_content)
  40. add_img()
  41. get_durations()
  42.  
  43.  
  44.  
  45. audio_clip = [AudioFileClip(n)
  46. for n in mp3_files]
  47.  
  48. clips = ImageSequenceClip(img_from_folder, durations=durations)
  49.  
  50. clips.write_images_sequence('xzsdscdsd.mp4', fps=24)
  51.  
  52. #concat_clip = concatenate_videoclips(clips, method="compose")
  53. #new_audio = concatenate_audioclips(audio_clip)
  54. #concat_clip.audio = new_audio
  55. #concat_clip.write_videofile('test.mp4', fps=24)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement