With ffmpeg you send a file, a test pattern or any other source ffmpeg can read to an input of your studio over SRT. For that you need an ffmpeg that was built with libsrt, and the input's address from the “Eingänge” (inputs) tab.

The command line below is the form we test with ourselves. You only put in host, port and stream ID.

Preparation

  1. Check whether your ffmpeg can do SRT: ffmpeg -protocols has to name srt in its list. An entry srtp is something else and is not enough. If srt is missing, you need an ffmpeg with libsrt. Where to get one is on ffmpeg.org.
  2. Open your studio and click “Quelle verbinden” (connect source) at the input on the “Eingänge” tab. Its address is shown there. It has the form srt://<host>:<port>?streamid=<id>.
  3. Take host, port and stream ID over into the command line. The other parameters behind the question mark stay as they are below.

Sending a file

ffmpeg -re -i input.mp4 -c:v libx264 -preset veryfast -tune zerolatency -pix_fmt yuv420p -b:v 6M -maxrate 6M -bufsize 6M -g 120 -bf 0 -c:a aac -b:a 128k -ar 48000 -ac 2 -f mpegts "srt://<host>:<port>?mode=caller&transtype=live&latency=200000&pkt_size=1316&streamid=<id>"

The quotation marks around the address are needed because the shell would otherwise interpret the & itself.

What the parts mean

Part Meaning
-re Reads the source in real time. Without it ffmpeg sends the file as fast as it can compute, and the studio gets no usable live signal.
-i input.mp4 The file that is sent.
-c:v libx264 The picture is encoded as H.264. The studio also accepts H.265, for example with -c:v libx265.
-preset veryfast -tune zerolatency Fast encoding without additional delay in the encoder.
-pix_fmt yuv420p The usual pixel format for live streams.
-b:v 6M -maxrate 6M -bufsize 6M 6 Mbit/s for the picture, with an upper limit. That keeps the bitrate even.
-g 120 A keyframe every 120 frames. At 60 frames per second that is 2 seconds.
-bf 0 No B-frames.
-c:a aac -b:a 128k -ar 48000 -ac 2 Sound as AAC, 128 kbit/s, 48 kHz, stereo.
-f mpegts Packs picture and sound as MPEG-TS, the format SRT sources send in.

And the parameters in the SRT address:

Parameter Meaning
mode=caller ffmpeg sets up the connection, your studio accepts it.
transtype=live SRT in live mode.
latency=200000 The SRT latency. ffmpeg expects it in microseconds: 200000 are 200 ms.
pkt_size=1316 The packet size that fits MPEG-TS.
streamid=<id> The stream ID of your input. By it the studio recognizes which input the signal belongs to.

There is no passphrase. Do not append a passphrase parameter.

Sending a test pattern

If you have no file at hand or only want to check the link, ffmpeg produces picture and sound itself: a moving test pattern in 1080p at 60 frames per second and a tone of 1 kHz.

ffmpeg -re -f lavfi -i testsrc2=size=1920x1080:rate=60 -re -f lavfi -i sine=frequency=1000:sample_rate=48000 -c:v libx264 -preset veryfast -tune zerolatency -pix_fmt yuv420p -b:v 6M -maxrate 6M -bufsize 6M -g 120 -bf 0 -c:a aac -b:a 128k -ar 48000 -ac 2 -f mpegts "srt://<host>:<port>?mode=caller&transtype=live&latency=200000&pkt_size=1316&streamid=<id>"

The command runs until you end it with Ctrl+C. The test pattern shows up on the desk as this input's scene, the tone on the input's level meter.

Adjusting

  • Another frame rate: the keyframe distance should stay 2 seconds. At 30 frames per second you write -g 60, at 50 frames -g 100.
  • A weaker link: lower the bitrate, for example -b:v 4M -maxrate 4M -bufsize 4M. Guide values are in The right encoder settings.
  • More latency: on an unsteady connection you raise latency, for instance to 1000000 for one second. Which values make sense is explained in Setting the SRT latency.

When nothing arrives

  • If ffmpeg reports that it does not know the protocol, libsrt is missing in your ffmpeg.
  • If the connection breaks off at once, compare host, port and stream ID with the “Eingänge” tab once more.
  • If ffmpeg seems to run normally and still no picture appears in the studio, No picture in the studio helps further. In many hotel and company networks UDP is blocked, and SRT needs UDP.