[FFmpeg-devel] Filter with multiple inputs, specific format on second and third input?
Nicolas George
george at nsup.org
Fri Mar 11 16:33:18 CET 2016
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160311/18332c2f/attachment.sig>
More information about the ffmpeg-devel
mailing list