PW Akshay


generate functionMon, 05 Dec 2022

live stream m3u8 to youtubein python using rtmpy

from subprocess import Popen, PIPE def youtube_stream(url, streamKey): ffmpeg = ['ffmpeg', '-i', url, '-vcodec', 'copy', '-acodec', 'aac', '-ar', '44100', '-f', 'flv', streamKey] p = Popen(ffmpeg, stdout=PIPE, stderr=PIPE) while True: output = p.stderr.readline() if output == '' and p.poll() is not None: break if output: print(output.strip().decode('utf-8'))

Questions about programming?Chat with your personal AI assistant