PW Akshay


generate functionSun, 04 Dec 2022

stream m3u8 url to rtmp in python (with pyM3U8)

from pym3u8 import load m3u8_url = 'https://some.m3u8' rtmp_url = 'rtmp://some.rtmp' def stream_m3u8_to_rtmp(): m3u8 = load(m3u8_url) for segment in m3u8.segments: print("streaming segment: ", segment.absolute_uri)"ffmpeg -i {} -c copy -bsf:a aac_adtstoasc {}".format(segment.absolute_uri, rtmp_url), shell=True) print("end of stream??") if __name__ == "__main__": stream_m3u8_to_rtmp()

Questions about programming?Chat with your personal AI assistant