PW Akshay

Generation

generate functionMon, 05 Dec 2022

Program to stream m3u8 urlto rtmp in python using FLVStream .

import ffmpy import subprocess import shlex import sys import os def execute(cmd): """ Function to execute a system command and return the output. """ args = shlex.split(cmd) try: output = subprocess.check_output(args, stderr=subprocess.STDOUT).decode("utf-8") return output except: return None if __name__ == '__main__': # URL to the m3u8 file url = 'http://playertest.longtailvideo.com/adaptive/bbbfull/bbbfull.m3u8' # output RTMP URL output = 'rtmp://YOUR_RTMP_URL' # command to fetch key cmd = 'ffprobe -v quiet -print_format json -show_format -show_streams ' + url output = execute(cmd) if output is not None: key = None # if key is present, fetch it if '#EXT

Questions about programming?Chat with your personal AI assistant