A way to show Multiple Updated Videos

Hi OFpeople,

Well, I was reading this last topics; multiple-videos-manipulation, question-about-textures,movie-Recorder… but I got a case that I don´t know how to classify it and the I don´t know how use the best way.

The main issue is I want to show videos of a mount (arround 3000) of images that I ve saved in the computer, and this images are dynamically updated. I think that I want is to have a fast access to all the images, select the images that I want to show, and do it as fast as possible.

Then , It´s better have all the images from hard disk first charged on memory , and show the images indexing all time witch image I want to show?

Or is better select the images to show , charge them to the GPU to show as texture, updating witch image I want to see and witch not?

Or use the Quicktime Api, where really I don´t know if it´s possible to modify a video, removing for example the last the frame , and adding a new frame instead of this…

Is great look that just recently there are some people working on video staff, well any suggestion? I’m scared about results, but may be I will start charging all the images in memory, indexing all them in vector lists , and get fast access to the images, to show and update them.

rgds

if you’re only showing a few images in any one frame (ie less than 100) it should make no difference whether you load them to the GPU or just store them in normal memory.

you can get away with loading a few images at runtime. the problem is when you try and load lots of them. so probably best to load all the images you find at load, and then scan the drive periodically for changes and only load the changes.

d

Hi Damian ,

Thanks for the explanation. But only to be more sure, If for showing a video , you say to the GPU witch frame is going to be rendered , and at the same time witch frame is the next… is It an improve to show video ?

rgds

i suspect you’re worrying about this too much :slight_smile: it takes such a tiny amount of time to transfer an image from memory to the graphics card that there is absolutely no need to have the ‘next frame’ in graphics card RAM rather than in main RAM.

short answer: no, no improvement.

May be I am worried too much :slight_smile:

Only to make some documentation , What about Quicktime Api ? Looking at this post there are a nice way to get multiple videos threaded. But for update the videos it should be necessary access to the video with the Quicktime Api…

regards

What about creating a MovieManager that has several instances of Movies which inherit from the ofThread class? Then you don’t have to worry too much more about Quicktime, and you can get on with making the structure of your program.

I.e.

  
class ofxMovie:public ofxThread{  
public:  
//methods to load the movie, check if it's loaded etc  
private:  
//useful things like  
ofVideoPlayer theMovie;  
}  
  
class ofxMovieManager  
{  
public:  
/*methods to add movies to be loaded in a threadlike manner, and report their status*/  
private:  
//useful things like  
ofxMovie * movies[OFX_MOVIES_NUMBER_OF_MOVIES_TO_LOAD];  
//use an array as std::vectors are not thread safe... (-;  
}  

Get the FAT release of whichever OS you are working on and have a look in the:

  
apps/addonsExamples/threadExample  

For some more threading.

For Quicktime playing and loading, have a look at:

  
apps/examples/moviePlayerExample  

Threads are fun! If you are using XCode, Performance Tools are your friend. Try MallocDebug and Shark if you run into problems. Don’t forget to look at all of the threads you have created. Some of the other public Addons at:

http://addons.openframeworks.cc

Are useful, as they use threading in several cases.

You’ll want to copied the videos out of your class structure to render them I suspect - as openGL isn’t thread safe. I’ll be posting more information about a recent project soon which deals with some threading issues and others.

Update…

This post:

http://forum.openframeworks.cc/t/threaded-video-player/1335/3">threaded video player]http://forum.openframeworks.cc/t/threaded-video-player/1335/3

Is I think in the same area. You might want to look at Poco for timing and notification of when things complete - loading, or the time for which the video has been loaded, but unaccessed for X amount of time (for unloading videos that aren’t been used at the moment).

Cheers,

JGL

Well , may be it’s not possible , I don’t know how use Quicktime API (QuickTimeComponents.h), the only reference that I have founded in OF forum is the Movierecorder example, there are this options using the QuickTimeComponents.h

  
  
		void 			startMakingMovieInRam(int width, int height);  
		void 			finishMakingMovieInRam();  
		  
		void 			addFrame(unsigned char * pixels);  
		void 			addFrame(unsigned char * pixels, float frameDuration);  
		  
		void 			saveViaFileDialog();  
		void 			save(char * fileName);  
		  
		void 			listCodecs();  
		void			setCodecType(int codec);  

but don’t seems there are a easy way to remove a frame with QuickTimeComponents.h… and another issue if is necessary re encode all the video another time.

May be better try ffmepg for modify an encoded video (add new encoded frame at the start of the video , and remove one encoded frame at the end of it…

This looks like a Survailance software , that have to record several videos of the last 24 hours… but with the issue of have the option to show the video with fast access :x

Oops I didn’t see the last post.

To modify the video I had forgotten that it’s necessary move the internal images one position , and of course add a new frame and remove the last frame. a easy way is reencode a new video each time is updated one more image.

Thanks for the help, it’s great use Threads for this purpose. And poco for example to look if a movie are finally encoded and ready to play. Then try to have a thread creating videos periodically, and check if those are updated or not and take the more properly. that’s one way with the video option.

pd : I will come back to try with list of images, and then I will see some results. And check the video option.

BY