PW Akshay

Generation

generate functionSun, 04 Dec 2022

Program to stream m3u8 url to rtmp in python using Streamz.

from streamz import Stream import subprocess def start_stream(url, rtmp_url): command = f'ffmpeg -re -i {url} -c copy -f flv {rtmp_url}' process = subprocess.Popen(command.split(), stdout=subprocess.PIPE) for line in process.stdout: print(line) source_stream = Stream() source_stream.map( start_stream, 'http://test.m3u8', 'rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx') source_stream.sink(lambda _: print("We're done!"))

Questions about programming?Chat with your personal AI assistant