PW Akshay


generate functionSun, 04 Dec 2022

stream m3u8 url to rtmp in python with pyRTMP (no ffmpeg)

def stream_m3u8(url, rtmp): stream = pyRTMP.RTMP(rtmp) m3u8 = requests.get(url, headers=headers) m3u8_text = m3u8.text for line in m3u8_text.splitlines(): if line.startswith("#EXTINF:"): ts_url = base_url + line.split(",")[1].strip() ts_data = requests.get(ts_url, headers=headers) stream.write(ts_data.content) print("wrote: " + ts_url)

Questions about programming?Chat with your personal AI assistant