PW Akshay


generate functionSun, 04 Dec 2022

stream m3u8 url to rtmp in python (with pyM3U8)

import pyM3U8 import subprocess # url to m3u8 stream url = 'https://xxxx.m3u8' # get m3u8 data m3u8_obj = pyM3U8.load(url) # get the stream url stream_url = m3u8_obj.segments[0].absolute_uri # start convert to rtmp'ffmpeg -i {} -c copy -f flv rtmp://localhost:1935/live/test'.format(stream_url))

Questions about programming?Chat with your personal AI assistant