[FFmpeg-devel] Filter with multiple inputs, specific format on second and third input?
Paul B Mahol
onemda at gmail.com
Fri Mar 11 18:54:34 CET 2016
Dana 11. 3. 2016. 16:42 osoba "F.Sluiter" <fsluiter at gmail.com> napisala je:
>
> Thanks Nicolas, can you be a bit more specific on how I can change it to
> get what I need?
> Or is it not possible?
Its possible, just set explicitly formats for second and third input.
See similar how its done for extractplanes.
> Floris
>
> 2016-03-11 16:33 GMT+01:00 Nicolas George <george at nsup.org>:
>
> > Le duodi 22 ventôse, an CCXXIV, F.Sluiter a écrit :
> > > I am writing a filter that takes a video file and remaps pixels based
on
> > > second and third input.
> > > second and third input are pgm files, which should give me a list of
> > > integers (gray16) that I can use in the filter.
> > > However ffmpeg by default converts my pgm files to YUV.
> > > Is there a way to prevent that?
> > >
> > > Should I add something to the filter code to only accept gray16
encoded
> > > files as second (xmap) and third (ymap) input, but keep arbitray
video as
> > > input1?
> >
> > Not add, change. See below.
> >
> > >
> > > Command line:
> > > # ffmpeg -i INPUT.avi -i feep.pgm -i feep.pgm -lavfi
'[0][1][2]remap'
> > > OUTPUT.avi
> > >
> > >
> > > static int query_formats(AVFilterContext *ctx)
> > > {
> > > static const enum AVPixelFormat pix_fmts[] = {
> > > AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV440P,
> > > AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P,
> > > AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA420P,
> > > AV_PIX_FMT_YUV420P,
> > > AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P,
> > > AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
> > > AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
> > > AV_PIX_FMT_ARGB, AV_PIX_FMT_ABGR, AV_PIX_FMT_RGBA,
> > AV_PIX_FMT_BGRA,
> > > AV_PIX_FMT_0RGB, AV_PIX_FMT_0BGR, AV_PIX_FMT_RGB0,
> > AV_PIX_FMT_BGR0,
> > > AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
> > > AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE
> > > };
> > >
> >
> > > return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
> >
> > By using ff_set_common_formats(), you set the formats for all inputs and
> > the
> > output to a pointer to this list, the same copy in memory. That means
(1)
> > your second and third inputs do not accept gray16, and (2) all three
inputs
> > and the output must have the same format at the end.
> >
> > Regards,
> >
> > --
> > Nicolas George
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
More information about the ffmpeg-devel
mailing list