Skip to content
Callaba

Publish an RTMP stream with FFmpeg and verify it

On this page

FFmpeg can publish an RTMP test source to an assigned endpoint, but a completed command is not the acceptance result. Use a known input, protect the URL and key, then verify publisher activity, decoded media, and the selected receiver path.

Choose the access mode first

In controlled mode, Publisher and Receiver are separate roles on the same configured stream name and can use the same RTMP URL. In Guest mode, deliberately open the endpoint and use a nonempty stream name; the receiver must use that same name.

Before you publish

Get the RTMP publish URL and stream key from the deployment. Do not paste a real key into a shell history, ticket, or article. Confirm your FFmpeg build exposes RTMP support: The FFmpeg protocol documentation describes protocol options; its format documentation covers muxer behavior.

Command
ffmpeg -protocols | grep rtmp

Expected result: the command lists an RTMP protocol variant supported by that build. If it does not, adapt the test to the installed build instead of assuming a package includes the protocol.

Publish a file at real-time pace

Command
ffmpeg -re -stream_loop -1 -i input.mp4 -c copy -f flv "rtmp://INGEST_HOST:PORT/APP/STREAM_NAME_OR_KEY"

Expected result: FFmpeg continues to report frame progress rather than sending the file as fast as storage allows. -re reads a file at native rate for this bounded test. Replace the placeholders with values issued for the listener; do not alter the application path or key.

Transcode when the output contract needs it

Command
ffmpeg -re -stream_loop -1 -i input.mov -c:v libx264 -pix_fmt yuv420p -g 60 -c:a aac -ar 48000 -b:a 128k -f flv "rtmp://INGEST_HOST:PORT/APP/STREAM_NAME_OR_KEY"

Expected result: the receiver sees a continuous publisher with decodable video and audio. This is an example, not a universal encoding prescription: choose frame rate, GOP/keyframe interval, bitrate, resolution, and audio parameters for the actual receiver and delivery workflow.

Verify at the server, then at the intended outcome

  1. Confirm the RTMP Server reports the expected publisher and incoming bitrate.
  2. Check picture and audio from the configured receiver or monitoring point.
  3. Test the one intended downstream output: recording, route, or browser player.
  4. Interrupt the process once and verify the receiver state and recovery plan.

For a live capture device, replace the file input with its documented FFmpeg input syntax and keep the same server-side acceptance checks. Avoid automatic reconnect loops until you know how the listener treats duplicate sessions; a loop can obscure the first useful error.

Choose the supplied endpoint protocol

Use the endpoint protocol supplied for this job. Callaba RTMP Server provides the listener, access rules, and activity view; browser viewing uses a separately configured output.

Configure the listener in Callaba RTMP Server, use the operator guide for access and status checks, or follow RTMP to HLS when the intended result is browser delivery.

Local diagnostic sender and receiver

Command
ffmpeg -re -f lavfi -i testsrc2=size=1280x720:rate=30 -f lavfi -i sine=frequency=1000:sample_rate=48000 -c:v libx264 -pix_fmt yuv420p -g 60 -c:a aac -b:a 128k -f flv "rtmp://INGEST_HOST:PORT/APP/STREAM_NAME_OR_KEY"

Expected result: FFmpeg reports video frames at about 30 fps and one audio stream; Callaba reports input bitrate. The GOP value of 60 gives a keyframe every two seconds at 30 fps, a practical starting point for a two-second segment workflow—not a required server setting.

Copy only after checking the input: ffprobe -v error -show_entries stream=codec_name,codec_type -of default=nw=1 input.mp4. Use this output to compare the input codec and audio details with the receiver’s documented contract. Copy is reasonable only after they match. For a diagnostic receiver, ffplay -fflags nobuffer "rtmp://RECEIVER_HOST:PORT/APP/STREAM_NAME_OR_KEY" should open picture and tone after the receiver connects. Consult FFmpeg filter sources for testsrc2 and sine.

Next steps

Configure the listener in Callaba RTMP Server, then verify access and activity in the operator guide.