pythonnode.jsffmpegwebrtcmkfifo

Sending video stream from NodeJS to python in real time


I'm using a NodeJS server to catch a video stream through a WebRTC PeerConnection and I need to send it to a python script.

I use NodeJS mainly because it's easy to use WebRTC in it and the package 'wrtc' supports RTCVideoSink and python's aiortc doesn't.

I was thinking of using a named pipe with ffmpeg to stream the video stream but 3 questions arose :

Thanks all !


Solution

  • Finally, I found that the MediaStreamTrack API of Python's aiortc has recv().

    It's a Coroutine that returns the next frame. So I will just port my NodeJS script to python using this coroutine to replace RTCVideoSink. No piping or whatsoever !