-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to find a suitable output format for 'temp-file' #28
Comments
Thanks for the report! Imageio-ffmpeg only supports writing to a file on the file system, because it calls ffmpeg in a subprocess. Therefore imageio cannot write directly to a file-like object (like a socket). What happens is that ffmpeg is used to write the video to a temporary file, and then it's loaded and written to the file object. This happens about here in imageio/core/request.py. Now, this error looks a bit like ffmpeg needs a filename extension to determine the output format, and the temp file does not have such an extension. This can be reproduced: import imageio
import imageio_ffmpeg
ims = imageio.mimread("imageio:cockatoo.mp4", memtest="1000MB")
size = ims[0].shape[1], ims[0].shape[0]
gen = imageio_ffmpeg.write_frames("c:/users/almar/desktop/foo_video_no_ext", size)
gen.send(None)
for im in ims:
gen.send(im)
gen.close() |
Now how to fix this. The quick version would be to use The longer version would probably be to change |
This did not work and was captured in a github issue - imageio/imageio-ffmpeg#28 Asyncio credit - https://realpython.com/async-io-python/
Thanks for the response @almarklein and sorry for the long delay. I tried out your suggestion and it appears that imageio_ffmpeg write_frames() only works with string paths. It would be nice to have it accept file like objects too. This way one could write to a socket. Here's my code - ericnjogu/object-detection-visualization@0e14220 |
I agree, but this is not possible because we're calling |
I created imageio/imageio#509 in imageio to fix the issue with the temp file. But then I realized that it won't actually fix your problem: you want to be able to stream video to a file like object, and |
I am trying to read a video file and write it to a socket using the code below and it is failing. I would appreciate your help:
The code is failing with the stacktrace below (debug logging turned on):
The text was updated successfully, but these errors were encountered: