ofAxisGrab gst/gst.h error with maverick / OF v8

i’m trying with ofAxisGrab thinking this might work for the h264 video streaming, but i’m getting a gst/gst.h error file not found and wondering if this will even work anyhow or if there is a better way?

I’m following http://blog.geoffdonaldson.com/2013/02/14/using-the-gstreamer-sdk-in-openframeworks-under-osx-10-8-mountain-lion/ but wondering if this is correct fix to my problem (i cant find anything for maverick and OF v8)

i did a gstreamer addon for osx recently: https://github.com/arturoc/ofxGStreamer

there’s instructions on how to install it there. not sure if ofxAxisGrabber will directly work for what you are trying to do, i guess it’s related to the parrot AR you post about in another thread? But the code in that addon would give you a clue on how to use gstreamer to grab a network stream

@arturo oK thanks a lot - i’m downloading and installing the packages. Just to be clear - download and install all the three packages for gstreamer that you mentioned, then clone the ofxgstreamer folder to the OF addons folder ?

i tried the above but still got that error at ofGstUtils.h “gst/gst.h file not found”

and yea i’m not certain ofxAxGrabber will work either but as you said it might be a start to grab the TCP video stream. thanks!

I have a feeling I’m running into issues with GStreamer SDK’s with mac 10.9 , but not sure still … i can neither run any gst commands in terminal, and i tried to link the gstreamer.framework file to the ofaxisgrab frameworks but the gstreamer “header” file “can’t be found” so i’m thinking there’s an installation problem but i’ve tried a number of solutions thus far (installing an older build, installing all the plugins for gst, trying to do it through brew? …) . ok thanks

the way the addon is used in osx is by creating a new project using the PG and adding the addon from the PG, but you’ll need the latest OF version from github not 0.8

oh ok thanks - i’ll pull the latest version of OF … and try it.

Hi @arturo, I’m going to try this addon on Windows trying to install the same Gstreamer versions as described for the osx version. Do you know if this has been done yet? In your .mk I’ve noticed the Gstreamer SDK files aren’t linked or included for the Windows version.
If I manage I’ll give an update so Windows users can use the same addon.

I’m working on the windows version, i have an example working but it’s more difficult to setup than in osx and the PG doesn’t work yet since there’s some things like copying dll’s to the project bin folder that i haven’t added yet

1 Like

@arturo thanks again for this - i finally got it working :slight_smile: but I am not yet getting the camera stream - from the AR drone it’s transporting the TCP over 5556 ( IP is 192.168.1.1 )
Is there a way to specify the port for the networked stream ? (i’m still not sure this will work but It seems the closest I’ve come across)
Thanks again.

Actually I guess when connected to the drone’s wifi i can use 127.0.0.1:5555

Which seems to work but isn’t updating : maybe because of the following error in the console but i’m not sure. :
[warning] ofGstVideoUtils: update(): ofGstVideoUtils not loaded
[ error ] ofxHttpUtils: Connection refused

[notice ] ofxAxisGrabber: pipeline:
[notice ] ofxAxisGrabber: souphttpsrc location=“http://127.0.0.1:5555/axis-cgi/mjpg/video.cgi?videocodec=h264&resolution=640x480&compression=30&mirror=0&rotation=0&textposition=top&textbackgroundcolor=black&textcolor=white&text=0&clock=0&date=0&overlayimage=0&fps=0&audio=0&keyframe_interval=8&videobitrate=0&maxframesize=0” ! decodebin ! videoconvert ! videoscale
[notice ] ofGstUtils: setPipelineWithSink(): gstreamer pipeline: souphttpsrc location=“http://127.0.0.1:5555/axis-cgi/mjpg/video.cgi?videocodec=h264&resolution=640x480&compression=30&mirror=0&rotation=0&textposition=top&textbackgroundcolor=black&textcolor=white&text=0&clock=0&date=0&overlayimage=0&fps=0&audio=0&keyframe_interval=8&videobitrate=0&maxframesize=0” ! decodebin ! videoconvert ! videoscale ! appsink name=ofappsink caps=“video/x-raw, format=RGB, width=640, height=480”
[warning] ofGstVideoUtils: update(): ofGstVideoUtils not loaded
[ error ] ofxHttpUtils: Connection refused
[ error ] ofxAxisGrabber: couldn’t update parameters: -1: Connection refused
[ error ] ofxHttpUtils: Connection refused
[ error ] ofxHttpUtils: Connection refused
[ error ] ofxHttpUtils: Connection refused
[ error ] ofxHttpUtils: Connection refused
[ error ] ofxHttpUtils: Connection refused
[ error ] ofxAxisGrabber: couldn’t update parameters: -1: Connection refused
[ error ] ofxHttpUtils: Connection refused
[ error ] ofxHttpUtils: Connection refused
[ error ] ofxHttpUtils: Connection refused
[ error ] ofxHttpUtils: Connection refused
[ error ] ofxHttpUtils: Host not found: \377\377\377\377\300\321}
[ error ] Thread 2: unable to end/join thread

yes it seems like gstreamer can’t create the pipeline correctly, httputils is used for axis cameras to control things like focus… but i don’t think it’ll apply here.

The address you are using is wrong, that address is only for the local computer, you should be using something like 192.168.1.x the same you would use with ffmpeg. even with that i’m not sure that the pipeline used in ofxAxisGrabber will work

you can try creating your own gstreamer pipeline, instead of using ofxAxisGrabber create a ofGstUtils and pass the pipeline using setPipeline:

//.h
ofGstVideoUtils gst;
ofTexture texture;

//cpp
void ofApp::setup(){
    gst.setPipeline(pipelineStriing, 24, true, width, height);
    gst.startPipeline();
    texture.allocate(width,height,GL_RGB);
}

void ofApp::update(){
    gst.update();
    if(gst.isFrameNew())
        texture.loadData(gst.getPixelsRef());
}

void ofApp::draw(){
    texture.draw();
}

where pipelineString is the pipeline you would pass to gst-launch except the final sink which is not needed here since OF will create it’s own sink to retrieve the pixels from the pipeline.

in osx i think you can’t run gst-launch from anywhere, in the console go to the directory where you have the binary for gst-launch and from there use ./gst-launchto run it, once you manage to run get the video stream use that same pipeline with gstutils.

i’ve just updated the addon and the PG to work with visual studio. Note that you’ll need the latest version of OF and the PG from github

Sweet. So is it the official 0.8.0 version or the latest github version of OF? Is the PG you’re referring to the one at this repo?.

Thanks a lot gstreamer looks very promising as a cross-platform video solution.

yes you’ll need both OF and the PG from github not 0.8. you can download the PG from that repository but it’s also a submodule if you are using git, after cloning OF

git submodule init
git submodule update

@arturo ok I’m trying that then , getting the error below but I think i’m not fully understanding “pipelineString is the pipeline you would pass to gst-launch”
And also I dont know where do I set the port & IP address?

Just as advice, because I can run “ffplay tcp://192.168.1.1:5555” in terminal and get the video stream , would something like ofxvideopipe work instead to get the streaming video in an OF app? The problem with this is a 4 second latency/ delay in the video stream that I cannot figure how to fix

[notice ] ofGstUtils: setPipelineWithSink(): gstreamer pipeline: ! appsink name=ofappsink caps=“video/x-raw, format=RGB, width=640, height=360”
[ error ] ofGstUtils: setPipelineWithSink(): couldn’t create pipeline: link without source element

(:5743): GLib-GObject-WARNING **: invalid cast from ‘GstAppSink’ to ‘GstPipeline’

the pipeline is a string you pass to gstreamer to read the video, i guess it should be something like:

string pipelineString = tcpclientsrc host=192.168.1.1 port=5555 ! decodebin ! videoconvert;

but it’s difficult to say wihtout testing, tcpclientsrc is the tcp client that connects to 192.168.1.1:5555 to read the video stream then it passes it to decodebin that should detect the format and uncompress it, finally videoconvert will convert the uncompressed video frames to RGB if necessary. From there OF is able to get the frames and return them as ofPixels that you can upload into a texture.

i haven’t used ofxVideoPipe so not sure if it’ll work

OK that was helpful thanks. I did try that but doesn’t seem to be working: in the console getting the following, so i think that it’s having trouble decoding the stream? not sure though

[notice ] ofGstUtils: setPipelineWithSink(): gstreamer pipeline: tcpclientsrc host=192.168.1.1 port=5555 ! decodebin ! videoconvert ! appsink name=ofappsink caps=“video/x-raw, format=RGB, width=640, height=360”

(:12505): GLib-WARNING **: unknown option bit(s) set

** (:12505): WARNING **: Compilation of mdvd regex failed: Error while compiling regular expression ^{[0-9]+}{[0-9]+} at char 0: unknown option bit(s) set

(:12505): GLib-WARNING **: unknown option bit(s) set

** (:12505): WARNING **: Compilation of subrip regex failed: Error while compiling regular expression ^[\s\n][\n]? {0,3}[ 0-9]{1,4}\s(\u000d)?
?[0-9]{1,2}: ?[0-9]{1,2}: ?[0-9]{1,2}[,.] {0,2}[0-9]{1,3} ±-> +[0-9]{1,2}: ?[0-9]{1,2}: ?[0-9]{1,2}[,.] {0,2}[0-9]{1,2} at char 0: unknown option bit(s) set

(:12505): GLib-WARNING **: unknown option bit(s) set

** (:12505): WARNING *: Compilation of dks regex failed: Error while compiling regular expression ^[[0-9]+:[0-9]+:[0-9]+]. at char 0: unknown option bit(s) set

(:12505): GLib-CRITICAL **: gboolean g_regex_match_full(const GRegex *, const gchar *, gssize, gint, GRegexMatchFlags, GMatchInfo **, GError **): assertion ‘regex != NULL’ failed

(:12505): GLib-CRITICAL **: gboolean g_regex_match_full(const GRegex *, const gchar *, gssize, gint, GRegexMatchFlags, GMatchInfo **, GError **): assertion ‘regex != NULL’ failed

(:12505): GLib-CRITICAL **: gboolean g_regex_match_full(const GRegex *, const gchar *, gssize, gint, GRegexMatchFlags, GMatchInfo **, GError **): assertion ‘regex != NULL’ failed

not sure what might be going on, would be helpful to know what kind of stream you are trying to decode, look in the documentation and try to find what protocol and compression format it uses then it would be easier to know what elements you need to put in the pipeline to receive the stream and decode it

Trying to build the ofxAxisGrabber example, using the latest ofxHttpUtils. Found the following:
There were minor build errors regarding u_long and the round function not being defined. (at ofxAxisGrabber.cpp).
Edit: Also found a linking error, already issued on github.

@gabriellalevine, about pipelines and other gstreamer nuances, if you have some time and are interested in the topic, there are some thorough tutorials here.

Hope it helps.

hi guys
I have tried ofxGstreamer + AR.Drone tcp stream which works well , a bit delay

here is the code

ofGstVideoPlayer* gstPlayer = new ofGstVideoPlayer();
player.setPlayer(ofPtr<ofGstVideoPlayer>(gstPlayer));
ofGstVideoUtils *gstUtil =  gstPlayer->getGstVideoUtils();
gstUtil->setPipeline("tcpclientsrc host=192.168.1.1 port=5555 ! h264parse ! decodebin ! videoconvert ! videoscale",24,true,640,360);
gstUtil->startPipeline();
player.play();

I also paste on gist here

1 Like