[FFmpeg-trac] #375(avfilter:new): earwax audio filter generates wrong pts and af_sox filter can not be applied.
FFmpeg
trac at avcodec.org
Mon Aug 1 02:50:27 CEST 2011
#375: earwax audio filter generates wrong pts and af_sox filter can not be
applied.
----------------------+--------------------------
Reporter: chinshou | Type: defect
Status: new | Priority: normal
Component: avfilter | Version: unspecified
Keywords: | Blocked By:
Blocking: | Reproduced: 0
Analyzed: 0 |
----------------------+--------------------------
Sorry, I do not know is it appropriate to report bug for audio filter
branch at https://github.com/mnzaki/FFmpeg/commits/audio-filters-20110726
.
I just try the audio filter branch for a while and noticed that when i set
-af earwax , the generated audio data pts always 0.
I added the avfilter_copy_buffer_ref_props(outref, insamples); call to
copy original pts to new samplesref and it seems to fix the problem.
static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef
*insamples)
{
int16_t *taps, *endin, *in, *out;
AVFilterBufferRef *outref =
avfilter_get_audio_buffer(inlink, AV_PERM_WRITE,
inlink->format,
insamples->audio->nb_samples,
inlink->channel_layout,
0);
+ avfilter_copy_buffer_ref_props(outref, insamples);//<<--copy pts
taps = ((EarwaxContext*)inlink->dst->priv)->taps;
out = (int16_t*)outref->data[0];
in = (int16_t*)insamples->data[0];
...
second, I guess we should add packing negotiate code to af_sox filter's
query_formats ,
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
avfilter_add_format(&formats, AV_SAMPLE_FMT_S32);
avfilter_set_common_sample_formats(ctx, formats);
avfilter_set_common_channel_layouts(ctx,
avfilter_all_channel_layouts());
+ avfilter_set_common_packing_formats(ctx,
avfilter_all_packing_formats());// << ---- packing negotiation
return 0;
}
otherwise avfilter_graph_config call will fail at
static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
{
...
else if (link->type == AVMEDIA_TYPE_AUDIO) {
if (!link->in_chlayouts || !link->out_chlayouts ||
!link->in_packing || !link->out_packing)
return AVERROR(EINVAL); <<------fail at here
if (!avfilter_merge_formats(link->in_formats,
link->out_formats) ||
!avfilter_merge_formats(link->in_chlayouts,
link->out_chlayouts) ||
!avfilter_merge_formats(link->in_packing,
link->out_packing))
...}
best regards
chinshou
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/375>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list