import Image
from subprocess import Popen, PIPE
fps, duration = 24, 100
p = Popen(['ffmpeg', '-y', '-f', 'image2pipe', '-vcodec', 'mjpeg', '-r',
    '24', '-i', '-', '-vcodec', 'mpeg4', '-qscale', '5', '-r', '24',
    'video.avi'], stdin=PIPE)
for i in range(fps * duration):
    im = Image.new('RGB', (300, 300), (i, 1, 1))
im.save(p.stdin, 'JPEG')
p.stdin.close()
p.wait()
Can you "stream" images to ffmpeg to construct a video, instead of saving them to disk?