Hello, folks.
I have a python program that does live streaming via rtmpsinc The code: import pygst pygst.require("0.10") import gobject gobject.threads_init() import gst import time class Publisher: def __init__(self): self.pipeline = gst.parse_launch("appsrc min-latency=1000 is-live=true do-timestamp=true name=source ! ffmpegcolorspace ! queue ! ffenc_flv ! flvmux ! rtmpsink location=\"rtmp://127.0.0.1/oflaDemo/test2 live=1\" ") self.source = self.pipeline.get_by_name("source") self.caps = gst.Caps("video/x-raw-rgb, width=(int)800, height=(int)592, framerate=(fraction)0/1, bpp=(int)24, depth=(int)24, endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680") self.source.set_property('caps', self.caps) self.source.connect("need-data", self.need_data) self.bus = self.pipeline.get_bus() self.bus.add_signal_watch_full(1) self.bus.connect("message", self.on_message) def need_data(self, src, need_bytes): #getting data here src.emit("push-buffer", buf) def on_message(self, bus, msg): print 'Message: ', msg.type, msg if __name__ == "__main__": p = Publisher() p.pipeline.set_state(gst.STATE_PLAYING) loop = gobject.MainLoop() loop.run() all works great, but sometimes program prints error: ERROR: WriteN, RTMP send error 9 ERROR: WriteN, RTMP send error 9 ERROR: WriteN, RTMP send error 9 ..... I want to handle this error to restart pipeline, but on_message does not recieve anything. Help me please. P.S. Sorry for my english, it's not native. _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Hi,
According to [1], src.emit("push-buffer", buf) should return GstFlowReturn which in case of your error should be GST_FLOW_ERROR. [1] http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-appsrc.html#GstAppSrc-push-buffer Hope this helps, Kris On 11/12/12 10:51, Bkmz wrote: > Hello, folks. > > I have a python program that does live streaming via rtmpsinc > > > The code: > > import pygst > pygst.require("0.10") > > import gobject > gobject.threads_init() > > import gst > import time > > class Publisher: > > def __init__(self): > > self.pipeline = gst.parse_launch("appsrc min-latency=1000 > is-live=true do-timestamp=true name=source ! ffmpegcolorspace ! queue ! > ffenc_flv ! flvmux ! rtmpsink location=\"rtmp://127.0.0.1/oflaDemo/test2 > live=1\" ") > self.source = self.pipeline.get_by_name("source") > > self.caps = gst.Caps("video/x-raw-rgb, width=(int)800, > height=(int)592, framerate=(fraction)0/1, bpp=(int)24, depth=(int)24, > endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, > blue_mask=(int)16711680") > self.source.set_property('caps', self.caps) > > self.source.connect("need-data", self.need_data) > > self.bus = self.pipeline.get_bus() > self.bus.add_signal_watch_full(1) > self.bus.connect("message", self.on_message) > > def need_data(self, src, need_bytes): > #getting data here > src.emit("push-buffer", buf) > > def on_message(self, bus, msg): > print 'Message: ', msg.type, msg > > if __name__ == "__main__": > > > p = Publisher() > > p.pipeline.set_state(gst.STATE_PLAYING) > > loop = gobject.MainLoop() > loop.run() > > all works great, but sometimes program prints error: > > ERROR: WriteN, RTMP send error 9 > ERROR: WriteN, RTMP send error 9 > ERROR: WriteN, RTMP send error 9 > ..... > > > I want to handle this error to restart pipeline, but on_message does not > recieve anything. Help me please. > > P.S. Sorry for my english, it's not native. > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Krzysztof, thanks. I'll try this.
11.12.2012 15:25, Krzysztof Konopko пишет: > Hi, > > According to [1], > > src.emit("push-buffer", buf) > > should return GstFlowReturn which in case of your error should be > GST_FLOW_ERROR. > > [1] > http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-appsrc.html#GstAppSrc-push-buffer > > Hope this helps, > Kris > > On 11/12/12 10:51, Bkmz wrote: >> Hello, folks. >> >> I have a python program that does live streaming via rtmpsinc >> >> >> The code: >> >> import pygst >> pygst.require("0.10") >> >> import gobject >> gobject.threads_init() >> >> import gst >> import time >> >> class Publisher: >> >> def __init__(self): >> >> self.pipeline = gst.parse_launch("appsrc min-latency=1000 >> is-live=true do-timestamp=true name=source ! ffmpegcolorspace ! queue ! >> ffenc_flv ! flvmux ! rtmpsink location=\"rtmp://127.0.0.1/oflaDemo/test2 >> live=1\" ") >> self.source = self.pipeline.get_by_name("source") >> >> self.caps = gst.Caps("video/x-raw-rgb, width=(int)800, >> height=(int)592, framerate=(fraction)0/1, bpp=(int)24, depth=(int)24, >> endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, >> blue_mask=(int)16711680") >> self.source.set_property('caps', self.caps) >> >> self.source.connect("need-data", self.need_data) >> >> self.bus = self.pipeline.get_bus() >> self.bus.add_signal_watch_full(1) >> self.bus.connect("message", self.on_message) >> >> def need_data(self, src, need_bytes): >> #getting data here >> src.emit("push-buffer", buf) >> >> def on_message(self, bus, msg): >> print 'Message: ', msg.type, msg >> >> if __name__ == "__main__": >> >> >> p = Publisher() >> >> p.pipeline.set_state(gst.STATE_PLAYING) >> >> loop = gobject.MainLoop() >> loop.run() >> >> all works great, but sometimes program prints error: >> >> ERROR: WriteN, RTMP send error 9 >> ERROR: WriteN, RTMP send error 9 >> ERROR: WriteN, RTMP send error 9 >> ..... >> >> >> I want to handle this error to restart pipeline, but on_message does not >> recieve anything. Help me please. >> >> P.S. Sorry for my english, it's not native. >> _______________________________________________ >> gstreamer-devel mailing list >> [hidden email] >> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel >> > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
It returns GST_FLOW_OK. I think this message is output from rtspsink.
11.12.2012 15:39, Bkmz пишет: > Krzysztof, thanks. I'll try this. > 11.12.2012 15:25, Krzysztof Konopko пишет: >> Hi, >> >> According to [1], >> >> src.emit("push-buffer", buf) >> >> should return GstFlowReturn which in case of your error should be >> GST_FLOW_ERROR. >> >> [1] >> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-appsrc.html#GstAppSrc-push-buffer >> >> >> Hope this helps, >> Kris >> >> On 11/12/12 10:51, Bkmz wrote: >>> Hello, folks. >>> >>> I have a python program that does live streaming via rtmpsinc >>> >>> >>> The code: >>> >>> import pygst >>> pygst.require("0.10") >>> >>> import gobject >>> gobject.threads_init() >>> >>> import gst >>> import time >>> >>> class Publisher: >>> >>> def __init__(self): >>> >>> self.pipeline = gst.parse_launch("appsrc min-latency=1000 >>> is-live=true do-timestamp=true name=source ! ffmpegcolorspace ! queue ! >>> ffenc_flv ! flvmux ! rtmpsink >>> location=\"rtmp://127.0.0.1/oflaDemo/test2 >>> live=1\" ") >>> self.source = self.pipeline.get_by_name("source") >>> >>> self.caps = gst.Caps("video/x-raw-rgb, width=(int)800, >>> height=(int)592, framerate=(fraction)0/1, bpp=(int)24, depth=(int)24, >>> endianness=(int)4321, red_mask=(int)255, green_mask=(int)65280, >>> blue_mask=(int)16711680") >>> self.source.set_property('caps', self.caps) >>> >>> self.source.connect("need-data", self.need_data) >>> >>> self.bus = self.pipeline.get_bus() >>> self.bus.add_signal_watch_full(1) >>> self.bus.connect("message", self.on_message) >>> >>> def need_data(self, src, need_bytes): >>> #getting data here >>> src.emit("push-buffer", buf) >>> >>> def on_message(self, bus, msg): >>> print 'Message: ', msg.type, msg >>> >>> if __name__ == "__main__": >>> >>> >>> p = Publisher() >>> >>> p.pipeline.set_state(gst.STATE_PLAYING) >>> >>> loop = gobject.MainLoop() >>> loop.run() >>> >>> all works great, but sometimes program prints error: >>> >>> ERROR: WriteN, RTMP send error 9 >>> ERROR: WriteN, RTMP send error 9 >>> ERROR: WriteN, RTMP send error 9 >>> ..... >>> >>> >>> I want to handle this error to restart pipeline, but on_message does >>> not >>> recieve anything. Help me please. >>> >>> P.S. Sorry for my english, it's not native. >>> _______________________________________________ >>> gstreamer-devel mailing list >>> [hidden email] >>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel >>> >> _______________________________________________ >> gstreamer-devel mailing list >> [hidden email] >> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel > _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |