[FFmpeg-devel] [PATCH] lavfi: add interleave filters
Stefano Sabatini
stefasab at gmail.com
Sat Apr 13 14:02:02 CEST 2013
On date Wednesday 2013-04-10 17:11:33 +0200, Nicolas George encoded:
> Le primidi 21 germinal, an CCXXI, Stefano Sabatini a écrit :
> > >From f88d1af608f99ed4f4fe7e1f9e2489049ade04f8 Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefasab at gmail.com>
> > Date: Mon, 8 Apr 2013 15:16:06 +0200
> > Subject: [PATCH] lavfi: add splice filters
> >
> > TODO: bump minor, add changelog entry
> > ---
> > doc/filters.texi | 43 +++++++
> > libavfilter/Makefile | 2 +
> > libavfilter/allfilters.c | 2 +
> > libavfilter/f_splice.c | 293 ++++++++++++++++++++++++++++++++++++++++++++++
> > 4 files changed, 340 insertions(+)
> > create mode 100644 libavfilter/f_splice.c
[...]
> > +static int request_frame(AVFilterLink *outlink)
> > +{
> > + AVFilterContext *ctx = outlink->src;
> > + SpliceContext *splice = ctx->priv;
> > + int i, queue_idx = -1;
> > + int64_t pts_min = INT64_MAX;
> > + AVFrame *frame;
> > +
> > + splice->req_fulfilled = 0;
> > + /* check if all the queues have available frames */
>
> > + for (i = 0; i < ctx->nb_inputs; i++) {
> > + struct FFBufQueue *q = &splice->queues[i];
> > +
> > + while (!ctx->inputs[i]->closed && !q->available &&
> > + !splice->req_fulfilled) {
> > + int ret = ff_request_frame(ctx->inputs[i]);
> > + if (ret < 0 && ret != AVERROR_EOF)
> > + return ret;
> > + }
> > +
> > + if (splice->req_fulfilled)
> > + return 0;
> > +
> > + if (q->available) {
> > + frame = ff_bufqueue_peek(q, 0);
> > + if (frame->pts < pts_min) {
> > + pts_min = frame->pts;
> > + queue_idx = i;
> > + }
> > + }
> > + }
> > +
> > + if (queue_idx < 0)
> > + return AVERROR_EOF;
> > +
> > + /* send out oldest frame */
> > + return push_frame(ctx, queue_idx);
>
> Suggestion: move the "find oldest input" loop to push_frame, and let it
> return in an additional parameter the empty input that is preventing it from
> progressing. I suspect you will reduce much code duplication.
Changed this, but I can't get the "additional parameter" stuff.
What works:
ffplay -f lavfi "color=c=red:d=5[l1]; color=c=blue[l2]; [l1][l2] interleave" -framedrop
ffmpeg -i ~/s/matrixbench_mpeg2.mpg -f lavfi -i testsrc=s=720x576,setsar=1/1 -filter_complex "[0:v]setsar=1/1, [1:v]interleave" -y out.nut
But if I set the duration in the second input I get:
ffmpeg -i ~/s/matrixbench_mpeg2.mpg -f lavfi -i testsrc=s=720x576:d=2,setsar=1/1 -filter_complex "[0:v]setsar=1/1, [1:v]interleave" -y out.nut
[...]
Failed to inject frame into filter network: End of file
Updated patch in attachment.
--
FFmpeg = Frightening and Fascinating Mere Pure Extensive Gadget
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-lavfi-add-interleave-filters.patch
Type: text/x-diff
Size: 13216 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130413/4c25026c/attachment.bin>
More information about the ffmpeg-devel
mailing list