ofDirectShowPlayer reverse playback

Hi All,

is it possible to set negative speeds (reverse playback) via setSpeed with ofDirectShowPlayer or is it a limitation of direct show or it’s implementation in oF?

I’m trying to do this with an .avi file that has video encoded as MJPG and PCM audio.

I’m testing on Windows 7 with of 0.8.4 in VS2012 using ofxDirectShow and with 0.9.0 in VS2015 using the ofVideoPlayer (as it should be using directshow).

I’ve also tested the same avi file in 0.8.4/VS2012 with the default VideoPlayer (which uses quicktime) and with ofxGStreamer and it works. I also tried ofxWMFPlayer but setSpeed is not implemented.

I’ve also tested using the 0.9.0/VS2015 videoPlayer example and the default .mov file
fingerMovie.getSpeed() returns 1.0, and the video doesn’t look to be reversed



Some codecs don’t like being played backwards, or any other way than realtime forwards really. A Quicktime encoded with Photo JPEG or PNG might be worth a shot.

I had great success with HAP encoded files and https://github.com/bangnoise/ofxHapPlayer
What I needed to do was to set the frame of the movie to anywhere I wanted, it was a movie of a guy on a turntable and I needed to be able to rotate it with the mouse. Not quite the same as what you need, but if that works I can’t see it being too hard to do what you need, if it doesn’t support it already.

not completely sure but i think this is a limitation with the new player. this new apis are super optimized to play video accelerated on the graphics card at speed 1x forward since that’s what most people use it for, movie players.

we’ve had similar issues with the new AVFoundation player in osx and although it’s working now it was really problematic to get it to work.

as @hahakid says hap player or any of the other players you’ve used (gstreamer will allow you to play almost any format) will allow you to play backwards.

also in general any format that is just an image sequence (like hap) will be easier to play backwards, scrub through… than anything with key frames and b frames like h264 or similar compressed formats which are mostly oriented to broadcasting on bandwidth limited networks so they compress a lot but are very hard to uncompress in other situation that is not playing forward at 1x speed

Hi @hahakid @arturo,

thanks for the replies. I had tried the hap player and that works well for reversing but it has some other performance issues that it seems to inherit from the use of quicktime as the base player in version 0.8.4.

As oF with version 0.9+ is using DirectShow as the base player I was looking for a solution that might work with that as the base performance is much better on windows in comparison to quicktime in v0.8.4.

My best option might be to separate into an image sequence and wav file to do what I’m after but it would be great to have a version of the directshow player with hap integrated in the future! :smile:

Do either of you know who is implementing directshow into oF? As it would be good to find out what the limitations of directshow are.


I am pretty sure @theo did the direct show player. There is also a directshow hap player ofxDSHapVideoPlayer (Windows)
that you can try using and maybe that will work better. That hap player is also based off the directshow implementation though by a different author.

As for knowing the limitations of the video players thats a bit tricky since a lot of video play back is handled by either direct show or windows media foundation and they handle playback differently. If you want the ability to set the speed I have a fork that allows for it but I have had pretty poor results with reverse playback.

I would try different codecs as some work better for indexing and variable playback while others are better compressed or less lossy etc… its why there are some many different codecs

Thanks for the links @DomAmato, I’ll check out your branch of WMFVideoPlayer as the one I had tested didn’t have an implementation of setSpeed.

The DSHapVideoPlayer also can’t handle reverse playback but it looks like DirectShow doesn’t support negative playback through it’s standard filters ( https://msdn.microsoft.com/en-us/library/windows/desktop/dd377591 ). So that would seem to be where the issue is and the solution would seem to be in writing a custom filter.

Aside from the reverse playback the DSHapVideoPlayer is super fast.