Hello everybody,
I'm trying to create a video with more or less 140 photos. I installed the library in a Raspberry to code in python the program and it's working very well. But when I want to copy this program in my server (with a Debian and with the library installed too), the video is create but I juste have a quarter of the photos in this video... This is my program:
import cv2
import os
import numpy as np
import shutil
from PIL import Image, ImageDraw, ImageFont
list = os.listdir('/var/www/public_html/jardins_de_bellecourt/Photos')
list.sort()
img = Image.open('/var/www/public_html/jardins_de_bellecourt/Photos/'+list[0])
frameW = img.size[0]
frameH = img.size[1]
print("w ", str(frameW))
print("h ", str(frameH))
nameTimelaps = list[0].split("_")
print("Creation de la video")
fourcc = cv2.cv.CV_FOURCC('T','H','E','O')
video = cv2.VideoWriter('/var/www/public_html/jardins_de_bellecourt/Timelaps/'+nameTimelaps[0]+'.ogv', fourcc, 2.5, (frameW, frameH))
fourcc = cv2.cv.CV_FOURCC(*'MP4V')
video2 = cv2.VideoWriter('/var/www/public_html/jardins_de_bellecourt/Timelaps/'+nameTimelaps[0]+'.m4v', fourcc, 2.5, (frameW, frameH), 1)
i = 0
while i < len(list):
src = '/var/www/public_html/jardins_de_bellecourt/Photos/' + list[i]
print(src)
img = Image.open(src)
font_type = ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf', 32)
draw = ImageDraw.Draw(img)
draw.text(xy=(30, 30), text = list[i], fill=(0, 0, 200), font = font_type)
img_out = np.array(img)
video.write(img_out)
video2.write(img_out)
print(i)
i += 1
video.release()
cv2.destroyAllWindows()
#shutil.rmtree('/var/www/public_html/jardins_de_bellecourt/Photos')
#os.mkdir('/var/www/public_html/jardins_de_bellecourt/Photos')
Can you help me with this ?
Thank you. Kevin