Play UDP Stream Locally Using FFmpeg

This article explains how to receive an incoming UDP (User Datagram Protocol) video stream and display it on your local machine using FFmpeg and associated media players. You will learn the exact commands needed to capture the network stream and render it in real-time using ffplay or by piping the FFmpeg output to external players like VLC.

Method 1: Using FFplay for Direct Playback

The simplest way to receive and display a UDP stream using the FFmpeg suite is by using ffplay, which is a self-contained media player utilizing the FFmpeg libraries.

To play a standard unicast or multicast UDP stream, open your terminal or command prompt and run:

ffplay -i udp://@0.0.0.0:1234

Reducing Latency in FFplay

UDP streams are often used for real-time, low-latency viewing. To minimize playback delay, add flags to disable buffering and reduce probe sizes:

ffplay -fflags nobuffer -flags low_delay -probesize 32 -i udp://@0.0.0.0:1234

Method 2: Piping FFmpeg to an External Player (VLC)

If you prefer to use a third-party player like VLC but want FFmpeg to handle the stream reception (for example, to transcode or filter the stream first), you can pipe the FFmpeg output directly into the player.

Run the following command to receive the UDP stream via FFmpeg and send it to VLC:

ffmpeg -i udp://@0.0.0.0:1234 -c copy -f mpegts - | vlc -

Troubleshooting Tips