ofxDSHapVideoPlayer (Windows)

@oscarw, sorry to hear that. please post one of your problematic files and i’ll take a look into it. i’m curious if your file is just RGB or contains an alpha channel.

i didn’t use any special settings for mpegstreamclip–just the defaults for HAP.

also worth checking what the value of videoSize is (in ofxDSHapVideoPlayer.cpp) and if it makes sense for the resolution of your video (i.e. 1280 x 720 x 3 = 2764800).

ps-the SampleCB error is just a timing issue that happens every now and then.

I’ve uploaded it to wetransfer (~77mb apologies but I didn’t want to tamper with it in any way)

I looked into this because I thought it might be the reason but according to ffmpeg its rgb0 which suggests it has another channel but the videoSize is correct (960 * 540 * 3) so I don’t think there is an alpha channel. At any rate, the sample video that does work also shows as being rgb0 on ffmpeg too!

I tried encoding a different video into Hap Alpha to see if somehow that would fix it but no luck

Hi, I have been trying this addon and performance seems great, thanks for the hard work. I have been testing with a 4K hap encoded AVI, it works fine for me in windows media player and it plays very smooth with the addon in OF, however there is a lot of colour banding when I play back in OF vs when I use windows media player.

The video is rendered clouds with a lot of detail and small changes in colour gradient. I get the colour banding an moire whether I play pix for pixel (my screen is less than 4k) or if I scale to fit my screen - even with a nice easy 1/4 res.

I encoded the file from proress with adobe media encoder.

Any ideas where the degradation could come from?


sorry for the late response. i’m not 100% sure where the quality degradation comes from–it could either be OpenGL’s decompression of DXT images or the DirectShow playback.

the best way to test if it’s an issue with the OF implementation (Direct Show) would be to save a particularly problematic frame as a still image, then export to a DXT file, then use OpenGL’s DXT display functionality to decompress and draw the image.


you’ll find the code to display DXT images in the HAP addon. reach out if you have any other questions.

oh–another thing to test is whether or not you’re using snappy compression in addition to DXT (see your export settings in Adobe Media Encoder). using snappy could lead to more artifacts.

you can also try using the high quality HAP codec and see if there are any improvements.

hope that helps!

Hey @oscarw, sorry I didn’t respond. I didn’t get it working and ended up with an entirely different solution. Did you find anything else?

Thanks, Jeremy. I ended up with a different solution, but I’m not sure where the crash was happening. Were you able to see anything from the file that Oscarw sent? I’m away from that system, but I’ll see if I can find out where it was crashing.

hi @ptterb, i did just push one fix that was allowed files that whose encoding did not include the total frame size to be playable. this worked (sometimes?) for files that were created using mpegstreamclip. but it sounded like the problem you were experiencing–with null pointer exceptions–was different. feel free to share that problematic file.

awesome! you save me !! a lot!
with this DSHap codec, I can save CPU usage!

1 Like

Hi @ptterb, apologies for the slow response. Jeremy was great and did the fix which meant I could use it with files from mpegstreamclip.

On the off chance if’s useful for anyone else I ended up converting them all with Adobe Media Encoder first from .mov with hap encoding into .mov with no hap encoding and then into .avi with the hap codec because if I tried it without the intermediate step it still wasn’t happy.

I am having a hard time converting my videos to Hap Alpha AVI files.
My input is Animation MOV files with RGBA.

  • Using Adobe Media Encoder my video doesn’t have Alpha channel, just a black background on OF
  • Using MpegStreamClip my video doesn’t play on OF
  • Using ffmpeg my video doesn’t play on OF

Any clue to have a good process for converting Animation Mov videos with alpha channel to Hap Alpha AVI?

Thanks a lot,



In Adobe Media Encoder, are you specifying that the file be encoded with HAP Alpha? There are 3 HAP codecs and HAP Alpha is the only one that supports alpha channels.

It would also be helpful to know if files without transparencies working for you.



I’m trying to get this plugin to work with x64 compiler, but I get the following error

ofxDSHapVideoPlayer.obj : error LNK2019: unresolved external symbol gluErrorString referenced in function "public: virtual bool __cdecl ofxDSHapVideoPlayer::load(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?load@ofxDSHapVideoPlayer@@UEAA_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>bin\ofxDSHapVideoPlayerExample_debug.exe : fatal error LNK1120: 1 unresolved externals

any hints? :slight_smile:

Hello @haelbichalex ,

I am getting the same error. Did you manage to get it work?


I’m trying to find a working ofxdshapvideoplayer addon for OF1.0.1, but not succeeded yet. ultracombos branch seems to be updated to Of1.0.0 but at least in VSOF1.0.1 (not tested) and is throwing the following error for OF1.0.1 and VisualStudio17:

dsuncompressedsamplegrabber.cpp(20): error C2664: 'CVideoTransformFilter::CVideoTransformFilter(const CVideoTransformFilter &)': cannot convert argument 1 from 'const wchar_t [28]' to 'LPCTSTR'

Any hint or update to be able to use Hap video for windows?

jusst got this issue this morning with of 0.10.0.
To have the right conversion of the const char to LPCTSTR you can put a L before the string
for me I change
#define FILTERNAME “Uncompressed Sample Grabber”
#define FILTERNAME L"Uncompressed Sample Grabber"
in DSUnCompressesSampleGrabber.h

1 Like

I’m experiencing a problem with this addon… It seems to work fine, unless I try to put instances of ofxDSHapVideoPlayer into an std::vector. In the below code, the active code does not work, but the commented-out code does.


class ofApp : public ofBaseApp{

//...generic oF stuff
		std::vector<ofxDSHapVideoPlayer> m_videos;
		ofxDSHapVideoPlayer m_noVecVid1;
		ofxDSHapVideoPlayer m_noVecVid2;


#include "ofApp.h"

void ofApp::setup(){
	ofxDSHapVideoPlayer video;

	ofxDSHapVideoPlayer video2;

//	m_noVecVid1.load("D:\\video1.avi");
//	m_noVecVid1.play();
//	m_noVecVid2.load("D:\\video2.avi");
//	m_noVecVid2.play();

void ofApp::update(){

void ofApp::draw(){
	m_videos[0].draw(0, 0, 800, 600);
	m_videos[1].draw(800, 0, 800, 600);
	//m_noVecVid1.draw(0, 0, 800, 800);
	//m_noVecVid2.draw(800, 0, 800, 600);

For the code that doesn’t work, only the 2nd video is played, and when I close the window, an exception is thrown for for the exception

is_block_type_valid(header-> _block_use)

Also, not sure if it’s relevant, but there are openGL warnings in the output console, though I think these are always there:

[warning] ofShader: GL_FRAGMENT_SHADER, offending line 1 :
1 uniform sampler2D cocgsy_src; const vec4 offsets = vec4(-0.50196078431373, -0.50196078431373, 0.0, 0.0); void main() { vec4 CoCgSY = texture2D(cocgsy_src, gl_TexCoord[0].xy); CoCgSY += offsets; float scale = ( CoCgSY.z * ( 255.0 / 8.0 ) ) + 1.0; float Co = CoCgSY.x / scale; float Cg = CoCgSY.y / scale; float Y = CoCgSY.w; vec4 rgba = vec4(Y + Co - Cg, Y + Cg, Y - Co - Cg, 1.0); gl_FragColor = rgba; }

Hi @s_e_p, I vaguely recall experiencing this before but I can’t remember what caused this issue (and it’s been a few years!).
Can you try creating and updating a vector of pointers instead?

void ofApp::setup(){
	ofxDSHapVideoPlayer * video = new ofxDSHapVideoPlayer();

	ofxDSHapVideoPlayer * video2 = new ofxDSHapVideoPlayer();

Hey @mantissa I’ve been having other problems with oF, so, in addition to doing a fresh download of oF, I also redownloaded this addon and, when I try to build the included example now, only changing the name of the file to load, I get a different error:

|Severity|Code|Description|Project|File|Line|Suppression State|
|Error|C3861|'gluErrorString': identifier not found|example|C:\Users\selli\openFrameworks\addons\ofxDSHapVideoPlayer\src\ofxDSHapVideoPlayer.cpp|1249||

so I can’t even try what you said in your last post… the error is, as indicated, here:

    if (err != GL_NO_ERROR){

        printf("error %s\n", gluErrorString(err));

…so I guess there are two errors- a GL error, but also that gluErrorString method not being declared or defined.

EDIT: OK, @mantissa , I deleted the addon and downloaded it from UltraCombos via smartgit, and the glu bug is gone, though I still get those GL warnings. I tried making a vector of pointers and… it works! Regular vector still doesn’t work.

By the way, is there a way to get the framerate of a video with this addon, or do I need to load in a json containing each of their framerates? (some of them are 30, some are 29.97 and some are 24).

Glad to hear that using pointers worked for you.

Re: the frame rate. We didn’t build this functionality in the original release but you can calculate it in your project by getting the frame count and then dividing by the duration.

Hope that helps!

Oh yeah, I forgot to update my post, but I figured that out. Thank you!

1 Like