PW Akshay

Generation

generate functionSun, 04 Dec 2022

stream m3u8 url to rtmp in python with pyffmpeg

import pyffmpeg input_url = "http://example.com/test.m3u8" output_url = "rtmp://127.0.0.1/live/test" stream = pyffmpeg.VideoStream() stream.open(input_url) out = pyffmpeg.VideoOutput(output_url, stream.streams[0].width, stream.streams[0].height, "flv", "libx264") while True: frame = stream.get_frame() if not frame: break out.write_frame(frame) out.close() stream.close()

Questions about programming?Chat with your personal AI assistant