Video artefacts when switching ofVideoPlayer pointers

Hey all,

I’m getting some strange video artefacts when switching between pointers to ofVideoPlayers. It’s usually a few frames from another video file, but can be garbage, which makes me think they are briefly pointing at the wrong place. This doesn’t happen when looping a single video.

This is happening both on OS X and Linux, the videos are H.264 mp4 files.


vector<string>              mFiles;
vector<ofVideoPlayer*>      mPlayers;
ofVideoPlayer*              mPlayer;
int                         mFileIndex;


void setup() {
    mFileIndex = 0;
    mPlayer = NULL;

    ofDirectory dir(VIDEO_PATH);
    if (dir.exists()) {

        for(int i = 0; i < dir.numFiles(); ++i) {
            mPlayers.push_back(new ofVideoPlayer());

    mPlayer =;

void update() {
    if (mPlayer && mPlayer->isLoaded()) {


        if (mPlayer->getIsMovieDone()) {
            mFileIndex = (mFileIndex + 1) % mFiles.size();
            mPlayer =;

Any thoughts much appreciated,

Arthur C

This garbage frame seems to occur on the 0th frame of the new player, so calling mPlayer->update() before mPlayer->play() does the trick.

Is this to be expected? The documentation implies that .play() should be called before .update()

Did you edit your code after you figured it out? It looks like you do call .update() before you call .play() already… unless I’m missing something? I’m having a similar problem when switching between ofVideoPlayer objects: garbage frames when they app is first run, and then a flashframe from the middle of the video every time I switch back to it (when I’m trying to start the video over).

In my code I called update on the old player, but not before calling play on the new player.

From what I remember, I may have still had issues as I ended up concatenating the videos and using a single video player in production.