64 bit Video player with dynamic speed changing

Hi there,
I’m looking for a video player that would support speed change dynamically.
The only one I found actually is the ofxHapPlayer but it compiles only in 32 bits.
ofxHapAVPlayer works well in 64bit but doesn’t support continuous speed changes.
(Continuous speed change meaning changing the speed without frame dropping and sound muting)
Any suggestions ?

(I’m on macOS 10.11.6, El Capitan with Xcode 8.2)

edit : Just tried the ofxVLCPlayer with no more success. My video file are recorded with ffmpeg from HLS stream in H264 at 25fps with AAC 44100 for the audio encoding.

the method: setSpeed of ofVideoPlayer it might be useful for this.

#include "ofMain.h"

class ofApp: public ofBaseApp
        ofVideoPlayer video;

        void setup(){

        void draw(){

        void keyPressed(int key) {
                        case '1':
                        case '2':
                        case '3':

int main()
        ofSetupOpenGL(1024,600, OF_WINDOW);
        ofRunApp( new ofApp());
1 Like

Thanks Kashim for answering.
Maybe I wasn’t quite clear, the “setSpeed” method works but not “continuously”, this mean that I have frame dropping and the sound stops a short instant each time it is used.

For me it works if I manually set the position of the movie by calculating the current position in every frame. I am using ofxHapAVPlayer.

for example

void ofApp::update() {
 float currentPosition = calculatePosition();

Thanks for the trick, it does work well for the frames but not for the sound which is still chopped and not “scrubbed”, do you have a particular calculation for the position?
I did it like this with the ofxHapAVPlayer :

float nextposition = player.getPosition() + ( speedRatio/player.getTotalNumFrames() * movieFrameRate/ofGetFrameRate() );

Actually I did not use audio in my project. Perhaps calculating an average value between the last played position or the current played position could help (or maybe not). Or you use a more advanced technique https://en.wikipedia.org/wiki/Audio_time_stretching_and_pitch_scaling

Maybe use Maximillian in parallel

I have a few things to add, Avfoundation does not permit that much freedom in speed changes, it is a built in limitation at the moment. Quicktime was actually better at this but is depreciated by apple.

Secondly your choice of codec will be really important for this. H264 is not a good choice for speed changes, go for a codec that does not use interpolation or i-frames. Higher end proress will be better, 422 is fine. Same with audio, less compression will help, so straight PCM. I would check out using windows instead and this addon https://github.com/secondstory/ofxDSHapVideoPlayer

Image sequences and audio may be a good way to go as well, but I think sync will be hard in that case.

hello @Mortec,

for a cross-platform 64bit video-only solution you might wanna check my addon ofxHPVPlayer that allows dynamic speed changing and fast scrubbing of frames. You can query the current position of the video file to sync an external audio file to it (or vice-versa)


Thanks all for responding.
The video files are recorded from HLS stream on the fly with a bash script and ffmpeg and I don’t want to deal with double files and a second encoding by splitting the audio from the video.
I tried the Apple Pro Res format with ofxVLCplayer, ofAVFoundationPlayer and ofxGStreamer but none of it works either. (I tried the 4 different profile, proxy, LT, SQ and HQ).
Also I did considered the ofxHPVPlayer before to post here but I can’t pre-encode the video since it is for an art installation that is supposed to play video freshly recorded from the web.
And from what I understand I can’t encode HPV video with ffmpeg.
So I guess I will do a second headless 32bit app that play HAP video and share the texture via Syphon; a few OSC messages should do the remote to control the speed and switch from a file to another.