Heiner
Heiner

Reputation: 195

libav audio latency / cannot set audio_buffer_size

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(&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 where we can get the currently active audio buffer size, so we can correct this elsewhere?

Upvotes: 0

Views: 93

Answers (0)

Related Questions