imageio-ffmpeg icon indicating copy to clipboard operation
imageio-ffmpeg copied to clipboard

support async

Open sugizo opened this issue 1 year ago • 2 comments

nice to support async ?

the ffmpeg parameter can be run using another python ffmpeg module e.g. module

typed-ffmpeg 
ffmpeg-python

e.g. code

import ffmpeg
url = 'http://takemotopiano.aa1.netvolante.jp:8190/nphMotionJpeg?Resolution=320x240&Quality=Standard&Framerate=30'
output = 'rtsp_%Y_%m_%d_%H_%M_%S.mp4'
scale = 'scale = 320 : -1'
segment_time = '00:01:00' 

stream = ffmpeg.input(url).output(filename = output, 
                                  vcodec = 'libx264', #acodec = 'copy', 
                                  reset_timestamps = 1, 
                                  strftime = 1, 
                                  f = 'segment', 
                                  segment_time = segment_time, 
                                  segment_atclocktime = 1, 
                                  vf = scale, 
                                  r = 25, ).overwrite_output().run_async()

to stop async stream.terminate()

best regards

sugizo avatar Mar 22 '24 14:03 sugizo

I'm not sure if I follow. You don't mean async as in await ... using asyncio, or do are you?

Your code example feels more like it will do the work in the background in a thread or something. This is out of scope of this library, because it represents a very specific use-cases, and one that can be implemented on top of imageio_ffmpeg.

almarklein avatar Mar 23 '24 21:03 almarklein

I'm not sure if I follow. You don't mean async as in await ... using asyncio, or do are you?

Your code example feels more like it will do the work in the background in a thread or something. This is out of scope of this library, because it represents a very specific use-cases, and one that can be implemented on top of imageio_ffmpeg.

yes

objective create video continously from rtsp camera with duration that defined in segment_time parameter

sugizo avatar Mar 26 '24 04:03 sugizo