Play FLV stream delay is too longer than other format via http interface.
Problem: We are using VLC as live player for our IP Camera. The video data is sent via HTTP interface. If we chose FLV as video data's container , the delay is obviously longer than other format such as mkv or raw h.264. Our video resolution is CIF. This issue may locate in av_open_input_stream() and av_find_stream_info() of libavformt. Cause: For FLV in libavformt, the open_header() callback does not detect the codec in FLV, so the codec used in FLV stream will be detected in av_find_stream_info(). Currently the av_find_stream_info()'s for FLV is not very good. It will fetch too many data to detected FLV's codec info "duration" filed. The fetch data size is defined in libavformat/options.c :
42 static const AVOption options[]={
43 {"probesize", "set probing size", OFFSET(probesize), FF_OPT_TYPE_INT, 5000000, 32, INT_MAX, D},
The default value is 5MB , I think this value is too big for our CIF FLV( for 384kbps, delay will be about 100 seconds, it not suitable for our real time application ).
Workaround: For FLV format, we can modify the "probesize" value before call av_find_stream_info() using :
if ( strcpm( p_sys->ic.name, "flv") == 0)
av_set_int(p_sys->ic, "probesize", 32000); //32K for FLV is enough