PW Akshay

Generation

generate functionSun, 04 Dec 2022

stream m3u8 url to rtmp in python (with pyM3U8)

import m3u8 import subprocess import time def stream(url): m3u8_obj = m3u8.load(url) for segment in m3u8_obj.segments: print(segment.uri) subprocess.call(['ffmpeg', '-i', segment.uri, '-c', 'copy', '-bsf:a', 'aac_adtstoasc', '-f', 'flv', 'rtmp://a.rtmp.youtube.com/live2/x/xxxxxxxx']) time.sleep(30)

Questions about programming?Chat with your personal AI assistant