i’m working on an application that needs to import large amounts of video. roughly about 40minutes of video divided in 4 or 5 clips.
i’ve noticed that some codecs are slower than others. i believe that codecs that compress a lot will be slower to read because more decoding will have to happen to play them. but having bigger files will also slow me down because a lot of memory will be used.
does anyone know of a good codec that makes relativelly small files and is not too heavy to read?
or maybe some way of dealing with reading large files without loosing too much performance?
p.s. and as along as we’re on subject
to do this i have been using a std::vector of ofVideoPlayer, so all videos are loaded at startup to different ofVideoPayer objects. is this the best way to deal with this? or would it be better to use a single ofVideoPlayer and deal with loading and closing the video as needed during runtime?
on the video side, I’ve been really satisfied with the Quicktime Photo-JPEG compression (no interframe compression) on my realtime projects.
I use it with many variants of size (800x600,640x480,400x300), FPS (24,15), and JPEG quality (49%,51%,61%).
I hope this helps your project,
Hi alexandre! obrigado for your reply. yes i have been using photo-jpeg. i was having problems with an app that needs to play large videos (1024x1536). i started getting really bad frame rates once i moved to windows (the computer that will run the app is a windows machine), but on osx it was still fast enough.
the solution was to use half sized videos and just resizing them when drawing. the funny thing is that on a mac book pro running windows (with dual boot) this raised the frame rate to about 20fps (with vertical sync off) and on the desktop that will run the app it runs at 75fps with vertical sync on (about 250 with vertical sync off)! and that computer is much older and worse than the mac book pro!
Hi Pelintra, theres a few things to look out for when playing large video. I’ve recently been looking into apps that can play pretty massive videos (upto 6144x768) and obviously ran into some problems:
1- data rate. photo-jpeg is usually very good, but you need to choose a quality setting that results in a data rate your harddisk can cope with comfortably. 60% pjpg for 6144x768 results in very good visual quality and manageable data rate.
2 - decoding. decoding millions of pixels can be slow, so you want a codec that is light to decode (hence in this case pjpg is better than say H264).
but the bottleneck is usually uploading all the texture data to the graphics card every frame - and that is slow. Playing a 25fps 1024x1536 video means uploading 112.5MB to the graphics card every second…painful. You say that the desktop computer is old, but maybe it has a more optimized bus or graphics card than the mbp?
P.S.If you are on osx, and need optimal performance with video, I suggest looking into the QTKit API. Its quite very to use and can render without using textures and you get amazing performance. Most video players choke like mad on a 4096 wide video, and can’t even run anything bigger (due to texture size limits). I can run the 6144x768 video at 25fps with no hiccups and I haven’t found another program that can even run the video, let alone at a decent frame rate… (apart from quicktime player of course).
Hi Memo. thanks for the tips
i also use photo jpg, but i cant reach 25fps with my 1000x1000pix quicktime on a 2.8 GHz imac. How can you disable textures? do you have an example?
Hi, it wasn’t in openFrameworks, but a native cocoa osx app. I’m gonna post the app on my site over the next couple days… will let you know. I might extend ofVideoPlayer with options for mac /leopard only fast rendering if I can…
Hey ascorbin, i’ve posted my native cocoa app at http://www.memo.tv/msa-qt-player-fullsc-…-video-outs
Theres no easy way to integrate it into openFrameworks unfortunately as its Objective C / Cocoa, don’t even know if it is possible to use Obj C in a C++ app (I know the opposite is possible) … and if it is, it would probably be a pain… I’ll still look into it though, maybe using Carbon its possible…
hey thanks a lot!
:? hm… im on 10.4.11, will try it on another machine 10.5
I got some success using Apple ProRes codec on HD material in some other programs using quicktime… but i havent tested it in of. But try that!
thanks for the tip. for now we already have this working. the solution we got was using half sized videos. not the best solution but since the videos we will display are very simple (mainly rectangles and simple geometrical shapes) it doesn’t make for any noticeable loss in quality.
but when i have some time i’ll make some more experiments and also want to have a look at the link memo posted, because i’ll need display large videos again for other projects.