PW Akshay

Generation

generate functionSun, 04 Dec 2022

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

import os import signal import subprocess from streamz import Stream from streamz.dataframe import DataFrame from streamz.dataframe import DataFrame def run_command(command): return subprocess.Popen( command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, preexec_fn=os.setsid, ) def kill_process_tree(pid, sig=signal.SIGTERM): """Kill an entire process tree (including grandchildren) with signal "sig" and return a (gone, still_alive) tuple. "gone" is a list of os.waitpid() style results for all the children that were killed. "still_alive" is a list of pid's that were alive before the signal was sent that were still alive after it was sent. """ assert pid != os.getpid(), "error: cannot kill self" parent = psutil.Process(pid) children

Questions about programming?Chat with your personal AI assistant