PW Akshay

Generation

generate functionMon, 05 Dec 2022

Program to stream m3u8 urlto rtmp in python using GStreamer .

def stream_m3u8_to_rtmp(m3u8_url, rtmp_url): Gst.init(None) pipeline = Gst.parse_launch("playbin uri={}".format(m3u8_url)) sink = Gst.ElementFactory.make("rtmpsink", "sink") sink.set_property("location", rtmp_url) pipeline.set_property("video-sink", sink) loop = GObject.MainLoop() pipeline.set_state(Gst.State.PLAYING) try: loop.run() except: pass pipeline.set_state(Gst.State.NULL)

Questions about programming?Chat with your personal AI assistant