stream with m3u8 to rtmp in python (no ffmpeg)
import sys import requests import ffmpeg import http import json import subprocess import streamlink import os import time import threading from urllib.parse import urlparse import datetime import dateutil.parser def m3u8(url, rtmp): # get m3u8 url from url streams = streamlink.streams(url) stream = streams["best"].url print("stream " + stream) start(stream, rtmp) def start(url, rtmp): # set up url = urlparse(url) url = url._replace(netloc='127.0.0.1:8080') url = url.geturl() rtmp = urlparse(rtmp) rtmp = rtmp._replace(netloc='127.0.0.1:1935') rtmp = rtmp.geturl() t = threading.Thread(target=thread, args=(url, rtmp)) t.start() def thread(