arturoc / ofxGStreamer

openFrameworks addon to use gstreamer under osx and windows. This addon has no code and instead uses the addon_config.mk file to add the needed files from the core + the flags needed to compile using gstreamer
56 stars 28 forks source link

Frame are choppy when load mjpeg over http server #21

Open gongzai1219 opened 5 years ago

gongzai1219 commented 5 years ago

I run a ffserver to stream DSLR live view, the format of output stream is mjpeg. When I check the view from a webbrowser, the view is ok and the latency is acceptable. After I load the http url by ofVideoPlayer, the view is shown but the frames are very choppy. Is there a way to solve it?

Here is my code:

void ofApp::setup(){
    ofSetFrameRate(60);
    ofSetVerticalSync(true);
    player.setPlayer(ofPtr<ofGstVideoPlayer>(new ofGstVideoPlayer));
    player.setPixelFormat(OF_PIXELS_NATIVE);
    player.load("http://192.168.3.120:8090/test.mjpeg");
    player.play();
}
//--------------------------------------------------------------
void ofApp::update(){
    player.update();
}
//--------------------------------------------------------------
void ofApp::draw(){
    player.draw(0,0);
    ofDrawBitmapStringHighlight("FPS: " + ofToString(ofGetFrameRate()), 20, 20);
}