6

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..)

4
  • 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"? Commented Dec 17, 2021 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. Commented Dec 17, 2021 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. Commented Dec 17, 2021 at 22:56
  • Last time I checked it was not possible have I posted a solution using FFmpeg. (Note: In Python it may be more elegant using other packages instead of subprocess). Commented Dec 17, 2021 at 23:00

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.