Hi,

I'm in the process of migrating to libavfilter based resampling using ffmpeg/libav 1.0 and the audio filter chain seems to be introducing audio clicks. Setting up a passthrough chain with...

    AVFilterContext* last = NULL;
    filterAudGraph = avfilter_graph_alloc();

    char args[255];
snprintf(args, 255, "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%llx",
        1, inpAudioCodec->sample_rate, inpAudioCodec->sample_rate,
av_get_sample_fmt_name(inpAudioCodec->sample_fmt), inpAudioCodec->channel_layout);

filterAudInp = tsUtilsInitFilter("abuffer", "audInput", args, NULL, filterAudGraph);
    last = filterAudInp;

    const enum AVSampleFormat formats[] = { AV_SAMPLE_FMT_S16, -1 };
    AVABufferSinkParams* params = av_abuffersink_params_alloc();
    params->sample_fmts = formats;

filterAudOut = tsUtilsInitFilter("ffabuffersink", "audOutput", NULL, params, filterAudGraph);
    av_free(params);

    avfilter_link(last, 0, filterAudOut, 0);

    avfilter_graph_config(filterAudGraph, NULL);

...where...

AVFilterContext* tsUtilsInitFilter(const char * filterName, const char* name,
    const char* arguments, void* opaque, AVFilterGraph* graph)  {

    AVFilter* filter = avfilter_get_by_name(filterName);

    AVFilterContext* context = NULL;
int ret = avfilter_graph_create_filter(&context, filter, name, arguments, opaque, graph);
    if (ret < 0) {
die("tsUtilsInitFilter - failed to create filter context <%s>", name);
    }

    return context;

}

...however, when a frame is added (I believe the input sample format, rate and channel layout is compatible with the required output) who's first few samples look like this...

00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ffffffff 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ffffffff 00000000 ffffffff 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

...upon retrieving the same frame from the chain the first 4 samples look somewhat different...

*000063f0 ffffb628 00002ff8 000008d9* 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ffffffff 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ffffffff 00000000 ffffffff 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

...the remainder of the frame is identical. These sample dumps are produced by...

    short* a = frame->data[0];
    for (int i = 0; i != frame->nb_samples; i++) {
        printf("%08x ", *(a++));
        if ((i % 16) == 15) printf("\n");
    }

....removing the filter chain and passing the decoded frames straight through to the encoder does not produce clicking. Any suggestions as to the cause would be gratefully received.


Regards

Ian
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to