[Ffmpeg-devel] Dealing with packet loss

Stefan Gehrer stefan.gehrer
Thu Oct 20 10:15:04 CEST 2005

Patrick Noffke wrote:

>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.
If you stay with ffmpeg's mpeg4, I think you should try
- a smaller GOP size (-g), maybe something around ten?
- data partitioning (option "vdpart" in mencoder, "-part" in ffmpeg)
- smaller slices (option "vpsize" in mencoder, maybe "-ps" in ffmpeg?)

I am not sure why -er 4 did not help you, but I can imagine that it's 
actually a decoder option.
BTW, this might be better placed on the user mailing list.

Stefan Gehrer

More information about the ffmpeg-devel mailing list