imageio / imageio-ffmpeg

FFMPEG wrapper for Python
BSD 2-Clause "Simplified" License
221 stars 50 forks source link

Set ffmpeg_timeout to zero by default. #30

Closed almarklein closed 4 years ago

almarklein commented 4 years ago

On an Ubuntu 18.04 VM, I can easily reproduce ffmpeg being killed using this script:

import imageio_ffmpeg
import numpy as np

ims = [np.random.uniform(0, 255, size=(1000, 1000, 3)).astype(np.uint8) for i in range(10)]

w = imageio_ffmpeg.write_frames("/home/almar/Desktop/foo.mp4", (1000, 1000), ffmpeg_timeout=0)
w.send(None)
for i in range(200):
    w.send(ims[i % 10])
    print(i)
w.close()
print("closed")

If we can assume ffmpeg to not hang doing nothing, it would be much better to set the default timeout to zero (i.e. wait until ffmpeg is done). However, we probably want to combine this with proper keyboardinterrupt handling #4.

almarklein commented 4 years ago

cc @djhoese because you're the one adding the timeout parameter