[Libav-user] Best way to provide avcodec_decode_video2 with h264 data?

Tony Glover T.Glover at nottingham.ac.uk
Thu Oct 25 11:43:51 CEST 2012

Hi Tim,
	Feeding raw video data into the decoder is fine, I was referring to live555's video framer (that is ultimately responsible for sending the data) that expects NAL units.

Live555 is good for streaming in a vast majority of cases, software such as VLC player uses live555.
You're always at the mercy of networks and they will drop packets over UDP, there is nothing you can do if the data is ultimately lost. What you can do is compensate for it as best you can. Ensure that the packets are sent to the decoder in the correct order - so if you receive a packet out of order you can wait for a small specified time for the correct one to arrive. If packets get dropped then so be it - just send the next one to the decoder.

I have had very similar issues to yourself - we installed some software at a customer site and their network was pretty terrible, installing the latest version of ffmpeg is always a good idea and helped me. The decoder should recover from a series of errors, if not then you need to look at your data to see just exactly how much data you are losing and if it really is that bad then it's a symptom of your network and not your software.

I would also look at bitrates and framerates. The x264 encoder can specify a maximum bitrate and tolerance so that you aren't hogging all the bandwidth. Ensure that your camera captures frames at the lowest, but still acceptable, rate.

Even apps such as skype struggle when the network is poor.



This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

More information about the Libav-user mailing list