Answer the question
In order to leave comments, you need to log in
How to load video in Opencv from byte string?
How can one read a byte string in cv2.VideoCapture? I tried like this:
cap = cv2.VideoCapture(io.BytesIO(decoded_vid)) # decoded_vid - bytes
TypeError: Argument 'index' is required to be an integer
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 390, in run_asgi
ff_videocomp_1 | result = await app(self.scope, self.receive, self.send)
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in __call__
ff_videocomp_1 | return await self.app(scope, receive, send)
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 179, in __call__
ff_videocomp_1 | await super().__call__(scope, receive, send)
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 111, in __call__
ff_videocomp_1 | await self.middleware_stack(scope, receive, send)
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
ff_videocomp_1 | raise exc from None
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
ff_videocomp_1 | await self.app(scope, receive, _send)
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
ff_videocomp_1 | raise exc from None
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
ff_videocomp_1 | await self.app(scope, receive, sender)
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 566, in __call__
ff_videocomp_1 | await route.handle(scope, receive, send)
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 227, in handle
ff_videocomp_1 | await self.app(scope, receive, send)
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
ff_videocomp_1 | response = await func(request)
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 182, in app
ff_videocomp_1 | raw_response = await run_endpoint_function(
ff_videocomp_1 | File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 133, in run_endpoint_function
ff_videocomp_1 | return await dependant.call(**values)
ff_videocomp_1 | File "./main.py", line 26, in process
ff_videocomp_1 | cap = cv2.VideoCapture(io.BytesIO(decoded_vid))
ff_videocomp_1 | TypeError: Argument 'index' is required to be an integer
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question