PW Akshay

Generation

generate functionMon, 05 Dec 2022

Program to live stream m3u8 to rtmp in python (no ffmpeg)

import requests import subprocess import threading import time import socket import urlparse import sys import os def get_local_ip(): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("8.8.8.8", 80)) return s.getsockname()[0] def get_public_ip(): return requests.get('http://ip.42.pl/raw').text def get_url_ip(url): return socket.gethostbyname(urlparse.urlparse(url).hostname) def get_public_ip_from_url(url): return get_url_ip(url) def check_ip_available(ip): if ip == '' or ip == "127.0.0.1": return False else: return True def get_ip_from_url(url): return check_ip_available(get_public_ip_from_url(url))

Questions about programming?Chat with your personal AI assistant