[Ffmpeg-devel] Dealing with packet loss

Patrick Noffke patrickn
Thu Oct 20 08:16:18 CEST 2005


Hi all,

I'm trying to stream video over the internet using RTP/UDP, and I'm getting about 5% lost packets, plus variable delay and reordering of packets.  I can simulate part or all of these network conditions on a local network using a Linux router between two LANs.  The Linux router uses the NISTNet Network Emulator, which can induce fixed delay, variable delay, dropped packets, and more.

I've managed to cope with the variable delay and reordering of packets, with the help of the live.com streaming library.  I had to make a slight tweak to increase a timeout after which it gives up on the current frame.  With this change, mplayer with live.com streaming works great.

Now I need to find a way to deal with the dropped packets (with 5% packet loss, the video corruption is too severe).  I can think of three approaches to tackle this problem:

1)  Use a different codec.  I've seen claims that H.264 is more error resilient, but I don't know if error-resilience features are in the x264 implementation (plus the live.com library doesn't yet support RTP streaming of H.264).  I'm encoding video with ffmpeg, using options:  -vcodec mpeg4 -b 100 -g 100.  I tried using -er 4, but this produced an identical file as when not using this option.

2)  Use forward error correction.  Are there any libraries available that might help with this?

3)  Try using flags in the IP headers to give my packets higher priority so they won't get dropped as easily.  I believe the TOS bits may have an effect, but I don't have any experience.

Does anyone here have practical experience to say which of these approaches (or another I haven't mentioned) would provide the best improvement on video quality?  Each of them is a fair amount of effort, so if I can, I want to avoid going down one path only to find it didn't help.  Could you please point me to any libraries or web references that might help me on my way?

Regards,
Patrick





More information about the ffmpeg-devel mailing list