I'm trying to record a live video (using H.264 codec
) from a series of pictures that i receive by socket using python.
I tried to use the MoviePy package (documentation here : github.com/Zulko/moviepy) on python to do that but i didn't figured it out.
If anyone have a guide on how to get started with python and saving pictures I receive as frames in real time using ffmpeg
, I would really appreciate it .
what I have is something like this , but it gives only the last captured image in the video it doesn't save continuously the stream of images :
from moviepy.editor import *
import numpy as np
while True:
data = sock.recv()
image = np.fromstring(data)
folder = [image]
cv = ImageSequenceClip(folder, fps = 1)
cv.write_videofile("video.mp4")