Streaming from FFmpeg to WebRTC

Hello everyone,

I’m looking forward to using Janus to serve video, and I hope this is the right tool. (As an aside, I tried some of the demos, and they seem promising, but I don’t see where one might find the code used to implement them.)

My particular question is how to get FFmpeg to stream RTSP to Janus, which I then want to pass on via WebRTC to my webpage. However, I’m stuck at step one. I compiled my own copy of Janus-gateway version 1.2.4, and I used these configuration options:

--enable-libsrtp2 --enable-websockets --enable-rest --enable-mqtt --enable-nanomsg --enable-plugin-textroom

I feel like I have a bit of a chicken & egg problem in that when I use FFmpeg to stream RTSP, it seems to expect another server there to be ready to connect to it, but then Janus also expects another server to be ready, so neither one will run because the other one isn’t running yet.

Specifically, Janus reports:

[ERR] [plugins/janus_streaming.c:janus_streaming_rtsp_connect_to_server:8124] Couldn't send DESCRIBE request: Couldn't connect to server (Failed to connect to 127.0.0.1 port 8554: Connection refused)
[ERR] [plugins/janus_streaming.c:janus_streaming_init:2792] Error creating 'rtsp' mountpoint 'rtsp-test'...

And FFMpeg reports:

$ ffmpeg -re -i myvideo.mp4 -c:v copy -f rtsp rtsp://127.0.0.1:8554/unicast
Connection to tcp://127.0.0.1:8554?timeout=0 failed: Connection refused
Could not write header for output file #0 (incorrect codec parameters ?): Connection refused

I’ve tried many variants to that command, including:

$ ffmpeg -re -i myvideo.mp4 -c:v copy -c:a aac -f rtsp -rtsp_transport tcp rtsp://127.0.0.1:8554/unicast

I can report that if I don’t use the RTSP protocol, FFmpeg is happy to stream the video, a la:

$ ffmpeg -re -i myvideo.mp4 -rtsp_transport tcp -c:v copy -preset ultrafast -tune zerolatency -b:v 500k -c:a aac -strict experimental -f mpegts tcp://127.0.0.1:55000

Of course, I don’t know that Janus can handle the MPEGTS protocol.

Might anyone have an example of how this works, or tip on what I might be doing wrong?

Thanks in advance,
Bill

No, Janus doesn’t do MPEGTS. You don’t need RTSP either (even though we support it), you can just stream raw RTP directly to an RTP mountpoint (which is what most do).