ofVideoPlayer analysis and async playing


#1

Hello oF community,

I have a question regarding ofVideoPlayer. I am interested in loading a short video (10 seconds) and analysing the frames using openCV.

All that is simple enough, however what I really want to do is do this in a single update call (possibly threaded) and calculate a list of timestamps and optical flow values which I can then reference later. Unfortunately I have no way of getting the pixels out of the video without calling “update()” which seems to do something internally based on ofGetElapsedTimef() (or something like that).

Curious if anyone has done anything like this and would be keen to point me in the right direction!

James Bentley


#2

Perhaps I should note, my first attempt is to create a class that inherits from ofVideoPlayer but overrides the functionality I don’t want in update. I also want to remove any texture business because for the cv stuff I only want pixels to convert to cv::Mats.

I’ll keep this thread updated with my progress.


#3

@Bentley I’m interesting in doing something similar. Were you able to solve it?


#4

if you use ofxGStreamer you can access the frames individually, without uploading to gpu or having to deal with timer issues.


#5

Is there somewhere an example of going through all the frames/pixels in a movie using gstreamer?


#6

@hamoid
Here’s some old code I used. It has some extra stuff in it but I think that you’ll get the idea.
cheers
(it needs the ofxGStreamer addon i think)
src copy.zip (6.0 KB)


#7

@roymacdonald thanks! I will give it a look!


#8

Thank you @roymacdonald ! Very useful :slight_smile: It seems like ofxGStreamer is Mac / Win only, but I hope it can work natively in Linux.


#9

ofxGStreamer just includes the files that are the default video utils in linux so they can be used in windows and osx so everything should work the same


#10

Hi there,

just coming back to this. I was actually not able to solve it and to tell you the truth I’ve completely forgotten the application that I had in mind for it!

Are you having any luck with the Gstreamer approach?

JB