UDP
Contents |
Streaming Video to VLC
VLC needs to be started first, before starting the capture device. From the menu, select Media->Open Network Stream..., then enter the network URL udp://1234, where 1234 is the UDP port number to use. From the command line, you can use a capture program to pipe the video stream to the netcat utility: capture ... | nc -u localhost 1234 where -u means to use UDP packets.
UDP buffer size
Linux
On Linux, the UDP send and receive buffers sizes may be too small for high bandwidth video, which can result in corrupted video due to dropped packets. Use the sysctl utility to set the net.core.rmem_max for max receive buffer size and net.core.wmem_max for the send buffer. The value is in bytes. For example, edit /etc/sysctl.conf to add the following lines, and use sysctl -p to load the new settings.
net.core.rmem_max = 26214400 net.core.wmem_max = 26214400
Windows
The same issue may occur on Windows 8, Windows 10 or later versions. To improve performance, create the DWORD values DefaultReceiveWindow and DefaultSendWindow under the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AFD\Parameters.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AFD\Parameters] "DefaultReceiveWindow"=dword:00040000 "DefaultSendWindow"=dword:00040000
These entries may be created by using regedit, or by creating a .reg file with the above text. After these registry entries are created, reboot the machine for the new settings to take effect.