Answer the question
In order to leave comments, you need to log in
Python, ffmpeg, nginx, wsgi?
Good day everyone! Faced the task of launching a video stream from cameras through nginx and faced some misunderstanding). I'll start with the backstory.
Initially, I assembled a bunch of nginx + ffmpeg + rtmp_modul and created the required number of applications. Everything works fine and even broadcasts in dash and hls. But in the future, it became necessary to launch the necessary camera by its id in the database for convenience. It was decided to write a script for preparing and launching the ffmpeg line in python (I'm just starting to make friends with python):
def ffstart(ip,rtsp,name):
pipeline = '/home/podkrilom/bin/ffmpeg -rtsp_transport tcp -i "rtsp://admin:[email protected]'+str(ip)+':554/cam/realmonitor?channel='+str(rtsp)+'&subtype=0" -s 1280x720 -f flv -vcodec copy -acodec copy rtmp://localhost:1935/'+str(name)
p = subprocess.Popen(pipeline, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return p.communicate()[0]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question