I'm generating a 1080p h264 video stream over UDP on an Ubuntu 14.04 LTS x86 host with gigabit ethernet using avconv:

avconv -re -i big_buck_bunny_1080p_h264.mov -f mpegts udp://pi:8765/

The plan is to have this played via omxplayer on the Raspberry Pi side, which is equipped with a 100mbps NIC.

However, I get pretty dramatic packet loss which completely garbles the stream. Using tcpdump to capture the first few seconds of the stream on the sender side gives me:

# tcpdump -w /var/tmp/send.cap port 8765
4525 packets captured
4525 packets received by filter
0 packets dropped by kernel

On the receiver side, I see around 30% packet loss:

# tcpdump -w /var/tmp/recv.cap port 8765
2925 packets captured
2942 packets received by filter
0 packets dropped by kernel

The receive capture shows that the first few packets arrive fine, and then we start dropping packets by the dozen. /var/tmp is a tmpfs so there shouldn't be any other I/O involved.

Note that the run above was done with flow control disabled. The kernel doesn't think any ethernet frames or UDP packets were dropped; this is confirmed by the /proc/net/usb and ifconfig output. This suggests that the loss is actually happening at the switch, which is trying to queue the input and running out of space.

One interesting point is that iperf in UDP mode in identical conditions (i.e. no flow control) does not show significant packet loss even close to 100Mbps -- and the packet captures are completely clean -- so this seems to be triggered by the way avconv sends UDP streams.

  • Have you tried restricting the output bit rate with -b? I'm guessing people use almost the same command to do a mov -> mpegts file conversion, in which case they want it done as fast as possible, which may be more than 100 Mbps output. If you actually want a live stream, you probably want to throttle it to an explicit rate. – goldilocks Jul 9 '15 at 17:15
  • Also note that getting 100 Mbps of data on a link limited to that speed will not happen -- cut it in half. However, searching around, it seems to me that 1080p quality mpeg compressed streams generally require < 10 Mbps. – goldilocks Jul 9 '15 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.