ffmpeg 有哪些filter

一只名叫tom的猫
浏览 1180回答 1
1回答

牛魔王的故事

  AVFilter  所有我们写的滤镜都要用一个AVFilter结构体讲给ffmpeg听。 这个结构体里描述了ffmpeg从哪个方法进入我们的滤镜。 这个结构体在libavfilter/avfilter.h里如下定义:    01 typedef struct  02 {  03 char *name; ///< 滤镜名称  04  05 int priv_size; ///< 给滤镜分配的内存大小  06  07 int (*init)(AVFilterContext *ctx, const char *args, void *opaque);  08 void (*uninit)(AVFilterContext *ctx);  09  10 int (*query_formats)(AVFilterContext *ctx);  11  12 const AVFilterPad&nbsp;*inputs; ///< 一系列输入&nbsp;NULL&nbsp;terminated list of inputs.&nbsp;NULL&nbsp;if none  13 const AVFilterPad&nbsp;*outputs; ///< 一系列输出&nbsp;NULL&nbsp;terminated list of outputs. NULL if none  14 } AVFilter;  “query_formats”方法用于设置可以接受的输入图像格式和输出的图像格式(用于滤镜链分辨哪些滤镜可以组合在一起用)。  AVFilterPad  这个滤镜用于描述滤镜的输入输出,在libavfilter/avfilter.h中定义如下:  01 typedef struct AVFilterPad  02 {  03 char *name;  04 int type;  05  06 int min_perms;  07 int rej_perms;  08  09 void (*start_frame)(AVFilterLink *link, AVFilterPicRef *picref);  10 AVFilterPicRef *(*get_video_buffer)(AVFilterLink *link, int perms);  11 void (*end_frame)(AVFilterLink *link);  12 void (*draw_slice)(AVFilterLink *link, int y, int height);  13  14 int (*request_frame)(AVFilterLink *link);  15  16 int (*config_props)(AVFilterLink *link);  17 } AVFilterPad;  头文件里有十分具体的描述,这里大概解释如下:  输入输出pad都可以用的元素:name pad的名字,所有的输入pad名字不能重复,所有的输出名字不能重复;type 此元素目前只能为“AV_PAD_VIDEO”值config_props 链接此pad的配置方法的函数指针  仅限输入pad使用的元素:min_perms 接受输入需要的最小权限rej_perms 不接受的输入权限start_frame 一帧传入时引用的方法的函数指针draw_slice 每个slice已经传入后引用的方法的函数指针end_frame 一帧完整结束后引用的方法的函数指针get_video_buffer 前一个滤镜调用,用以为一个图像请求内存  仅限输出pad使用的元素:request_frame 请求滤镜输出一帧
打开App,查看更多内容
随时随地看视频慕课网APP