2

I'm using OpenCV with Python, and I want to do something fairly simple: read frames in order and send them over network. This is actually working fine, but I have and additional requirement: I want to read that video from memory instead of disk - meaning, I already have the file buffered in memory (a buffer array, for instance) and I want to use that.

Is it possible? Looking at OpenCV's VideoCapture docs I couldn't find a constructor or method that accepts anything other than the device index or the filename, but I'm asking since, well, it seems the kind of functionality that should exist... (if that means anything..)

Bruno Brant
  • 8,226
  • 7
  • 45
  • 90
  • 1
    Have you scrolled to the next paragraph? It talks about stream URL and some "GStreamer pipeline", whatever that would be. Or what do you mean exactly on "video from memory instead of disk"? – tevemadar Dec 17 '21 at 14:38
  • @tevemadar Hmm, I guess I wasn't clear enough. I have the file in a in-memory buffer and I want VideoCapture to read from it. And I'm not using GStreamer in this case. – Bruno Brant Dec 17 '21 at 16:26
  • use ffmpeg. that's what OpenCV uses anyway. OpenCV is not a video handling library, it's for Computer Vision. it is intended to _not provide_ the flexibility you need. – Christoph Rackwitz Dec 17 '21 at 22:56
  • Last time I checked it was not possible have I posted a [solution](https://stackoverflow.com/questions/60558412/how-to-decode-a-video-memory-file-byte-string-and-step-through-it-frame-by-f) using FFmpeg. (Note: In Python it may be more elegant using other packages instead of subprocess). – Rotem Dec 17 '21 at 23:00

0 Answers0