Stream Video over UDP Multicast Using FFmpeg

This article provides a quick guide on how to stream a local video file over your local network using FFmpeg and UDP multicast. You will learn the exact command-line syntax required to configure FFmpeg, stream the media without lag, and receive the multicast stream on another device using a media player like VLC.

The Basic FFmpeg Multicast Command

To stream a local video file using UDP multicast, open your terminal or command prompt and run the following command:

ffmpeg -re -i input.mp4 -c:v copy -c:a copy -f mpegts udp://239.0.0.1:1234

Command Breakdown

Transcoding During Stream (Optional)

If your player cannot decode the original video format, you can transcode the stream on the fly to H.264 video and AAC audio with this command:

ffmpeg -re -i input.mp4 -c:v libx264 -preset veryfast -maxrate 3000k -bufsize 6000k -pix_fmt yuv420p -c:a aac -f mpegts udp://239.0.0.1:1234

How to Receive the Multicast Stream

To test and view your stream on another computer connected to the same local network, you can use VLC media player:

  1. Open VLC.
  2. Select Media (or File on macOS) > Open Network Stream.
  3. Enter the URL: udp://@239.0.0.1:1234 (the @ symbol tells VLC to bind to the multicast group address).
  4. Click Play.