[Libav-user] dshow capture / av_dict_set_int / audio_buffer_size

ffmpeg at mxwendler.net ffmpeg at mxwendler.net
Sat Apr 13 15:06:01 EEST 2024

Hi all,

For an audio/video capturing tool we open live capture devices with the 
following code:

AVFormatContext* ic = nullptr;
const AVInputFormat *iformat = av_find_input_format("dshow");
AVDictionary *options = nullptr;
av_dict_set_int(&options, "audio_buffer_size", 50, 0);
av_dict_set(&options, "framerate", "30", 0);
av_dict_set(&options, "video_size", "640x360", 0);
av_dict_set(&options, "sample_rate", "48000", 0);

auto err = avformat_open_input(&ic, "video=Integrated 
Camera:audio=Microphone Array", iformat, &options);

Audio *sample_rate*, *framerate* and *video_size* are correctly set, but 
the audio_buffer_size setting is ignored, resulting in a strong audio 
delay. Is there something wrong in the way we set it? The documentation 
says, the value is given in milliseconds (not sample size).

If audio_buffer_size cannot be set for all devices, is there an api call 
(or struct member) where we can get the currently active audio buffer 
size, so we can correct this else where?

Looking at the source (dshow.c) indicated that the audio_buffer_size is 
a member of priv_data / dshow_ctx struct, so there is no way to access 
it, i fear


Question also asked here:

Best regards,

More information about the Libav-user mailing list