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

Reducing lag on RSTP stream. #2

Closed crecord closed 10 years ago

crecord commented 10 years ago

Hello Arturo,

Thank you for the library. It's good to get the RTSP stream from my IP camera coming into OF! I am wondering if there is anyway of reducing lag since I am doing realtime processing with it.

When I view the footage in the camera's browser interface there is no lag, but when I use it through ofxGStreamer there is about a 4 second lag. Is there anyway I can help improve the performance?

( I noticed the camera interface said it was using a TCP protocol, perhaps this accounts for the difference?)

arturoc commented 10 years ago

are you using a custom pipeline or just the normal videoplayer with a rtsp url? if you have a custom pipeline there's usually a parameter you can pass to adjust the latency but i would need to see the pipeline to know which parameter you need to adjust

crecord commented 10 years ago

I am just using the videoplayer with the url currently. How would I make a custom pipeline? Would I use ofxGSTRTP as well?

crecord commented 10 years ago

Could you give me some pointers on creating a custom pipeline?

arturoc commented 10 years ago

sorry, i forgot about this. it's kind of complex and i have never used it so not sure if it'll work as it is, you'll probably need to investigate the properties of each element to get it to work, but mainly you need to use ofGstUtils instead of ofVideoPlayer. to initialize it:

ofGstUtils gst;

gst.setPipeline("rtspsrc location=url_of_the_video latency=100 ! rtpdec ! decodebin ! videoconvert", 24,true)
gst.startPipeline();

and then use a texture to manually upload the pixels from ofGstUtils to the graphics.

arturoc commented 10 years ago

each string in between ! in the setPipeline method is a gstreamer element connected to one another, like: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-rtspsrc.html if you look for each of them you can find what they do and which properties they have so you can adjust parameters like the latency