openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.89k stars 2.55k forks source link

DS video player is slow #4708

Open arturoc opened 8 years ago

arturoc commented 8 years ago

it's doing a swap and mirror in the cpu by default it also does the color space conversion in the CPU. we could add support for OF_PIXELS_NATIVE which would upload the pixels as they are directly to a texture and use the new facilities in the programmable renderer to do the colorspace conversion there. also the mirroring could happen there by providing it's own textures and marking them as inverted

ofTheo commented 8 years ago

Another option could be to look at the newer WMF API going forward - I think it has native H264 support so wouldn't require a codec pack just to play the files included in the examples.

I know there is ofxWMFVideoPlayer - and I think @DomAmato has been doing some updates ( https://github.com/DomAmato/ofxWMFVideoPlayer/commits/master ) to make it have more parity with the DS based one.

@DomAmato are there any outstanding issues or reasons that the current DS one is preferable over a WMF approach?

DomAmato commented 8 years ago

Reverse playback is sort of hit or miss depending on codec. To switch between it is a little odd too if i remember correctly as it polls the system if a playback rate is supported and if frame thinning is needed. I know some people had decent luck with fast playback rates and even reverse playback rates but I can for sure say that I have had some files not play in reverse at all. An easy test is the video example that comes with OF, I will say it runs large format video files much better though maybe that is due to to the computational overhead that @arturoc outlined.

charlesveasey commented 8 years ago

I had some trouble with ofxWMFVideoPlayer and videos > 2K x 2K. They didn't play back. DS video player worked but was slow. I'm guessing this is related to max texture size on the GPU?

DomAmato commented 8 years ago

its possible, i didn't write the presentation engine behind it obviously but I am pretty sure it was mutated from the Windows SDK examples and the NVidia interop examples. Thats where I got the playback rate from and the rest of the class looks similar to it. We could have both as options like the of sound steam API option and have it default to WMF since it supports more codecs. Seemed like every week a new forum post started with windows and video playback errors :|