Dank Anthony Ich versuchte Ffmpeg, für diese in pip3 install python-ffmpeg für Python3-Abhängigkeit installiert.
command = [FFMPEG_BIN,
'-y',
'-f', 'rawvideo',
'-vcodec', 'rawvideo',
'-s', dimension,
'-pix_fmt', 'bgr24',
'-r', '24',
'-i', '-',
'-an',
'-tune', 'zerolatency',
'-preset', 'ultrafast',
'-crf', '0',
'-b:v', '2000k',
'-qmin', '1',
'-qmax', '4',
'-qscale', '4',
'-vcodec', 'rawvideo',
feed]
self.proc = sp.Popen(command, stdout=sp.PIPE, stderr=None, stdin=sp.PIPE)
while True:
ret, frame = self.cap.read()
#some analysis done here
if ret:
self.proc.stdin.write(frame.tostring())
Ausgabe vcodec kann beliebiger Typ sein.
Dafür arbeiten ffserver.conf Datei in /etc/ffserver.conf wie this-
HTTPPort 1234
RTSPPort 1235
MaxClients 1000
MaxBandwidth 10000
<Feed feed1.ffm>
File /tmp/feed1.ffm
ACL allow 127.0.0.1
</Feed>
<Stream test1.sdp>
NoDefaults
Feed feed1.ffm
Format rtp
Noaudio
VideoCodec libx264
VideoSize 1920x1080
#VideoHighQuality
VideoBitRate 64
VideoFrameRate 17
VideoGopSize 25
VideoBufferSize 50000
AVOptionVideo flags +global_header
AVOptionVideo me_range 16
AVOptionVideo qdiff 4
AVOptionVideo qmin 30
AVOptionVideo qmax 34
ACL allow 192.168.0.0 192.168.255.255
PreRoll 0
</Stream>
erstellen und ausführen ffserver
wie sieht das ein Job für ffmpeg und seine Suite. – Anthony