← All articles

Streaming H.264 over Ethernet from an FPGA

The blocks between a camera and a player on a PC, and what our Nexys Video and Zybo Z7-20 builds measured at 1080p30.

IronKernel · · Video

A camera on an FPGA board and a player window on a PC are five blocks apart. This article walks through those blocks as we built them for H.264 video over Ethernet, and gives the numbers each of our two reference boards measured at 1080p30.

The five blocks

BlockJob
CaptureIronCapture receives two-lane MIPI CSI-2 RAW10, reconstructs color and writes packed YUYV frames to DDR.
EncodeIronH264 reads the frame from DDR and writes H.264 Constrained Baseline NAL units back to memory, with an index of byte ranges.
PacketizeFirmware or a Linux application reads each encoded picture, multiplexes an MPEG transport stream and sends UDP datagrams to port 5004.
NetworkRTLNet supplies the Ethernet MAC, ARP, ping, DHCP and UDP in logic.
PlayVLC or ffplay on the PC opens udp://@:5004.

The pixels never pass through the processor. The capture core and the encoder are both bus masters on DDR, so the CPU handles addresses, lengths and packets, and the frame data stays in memory until the encoder has compressed it.

Why the frame goes through DDR

A 1080p30 YUYV stream is 124.416 MB/s. Writing it to DDR gives the encoder a whole picture to work on and gives it the previous reconstructed picture for motion search. It also separates the camera's timing from the encoder's. The capture core finishes a frame and reports it; the encoder starts when software hands it that buffer.

The encoder writes its output to a ring in the same memory. When the ring fills, the encoder stalls, so unread data is never overwritten. Software reads the index, assembles one access unit per picture and marks the IDR pictures so a player that joins late has a place to start.

MPEG-TS over UDP

We send an MPEG transport stream in UDP datagrams because every common player opens it with no setup, and a receiver can join a stream that is already running. The transport stream carries a continuity counter in each packet, which gives a direct test for loss: a receiver that reports zero continuity errors received every packet in order.

What the two boards measured

Nexys Video (Artix-7 XC7A200T)Zybo Z7-20 (Zynq-7000 XC7Z020)
SourceOn-board test patternPcam 5C camera
EncoderTwo engines at 90 MHzOne engine at 121.85 MHz
SoftwareMicroBlaze V firmwareIronForge Linux on two Cortex-A9 cores
EthernetRTLNet RGMII MACThe Zynq's own Gigabit Ethernet
1080p3018,002 pictures in ten minutes, zero dropped, minimum PSNR 44.28 dB at QP 281,800 of 1,800 pictures encoded and decoded at 30.00 pictures/s, zero continuity errors
Bit rate7.99 to 8.02 Mb/s at an 8 Mb/s target20.45 Mb/s at QP 28 for the measured scene

The two builds are different, and the table says how. The Nexys build encodes a generated pattern with the camera input tied off. The Zybo build uses a real camera and sends through the processor's Ethernet, so RTLNet is not in that path.

Try it on a Nexys Video

The prebuilt bitstream on the system page holds the whole chain with the firmware inside it.

  1. Load the bitstream over JTAG with Vivado 2026.1.
  2. Open the UART at 115200 baud. show ip prints the address from DHCP.
  3. On the PC, run ffplay -fflags nobuffer udp://@:5004.
  4. On the console, enter enable, camera mode 1080p30, camera pattern all 4, encoder bitrate 8000 and stream h264 <PC address> 5004.
  5. show stream and show encoder print the picture counts, the bit rate and any dropped pictures.

Where the bit rate goes

The rate depends on the scene and the quantizer. The test pattern with a noise band is hard to compress on purpose: at constant QP 28 it ran 27.54 Mb/s on the Nexys. Rate control brought the same input to 8 Mb/s. For a lower rate at the same picture, the High Profile extension adds CABAC; our article on Baseline against High Profile has those measurements.

Further reading

Building a video-over-Ethernet design?

Send the FPGA part, the camera or video source, the resolution and the target bit rate.