参考

大牛对filter的介绍

filter 思想

  • filter 架构思想中第一个概念是 Graph,一般翻译为画布,如果 Graph 看做是桌子的话,那 filters 们就是桌子上的“悲剧”。所以先要有 Graph,然后再将 filter 摆在上面, filter是身上有 pin 接口, pin 的作用是统一数据接口,然后还需要一个 link 的动作, link 的作用是将指定的 2 个 filter 通过其 pin 接口连接起来,这样就形成了一个完整的 filter graph或是叫 filter link list。
  • 如果只有 filter graph 的存在,它只是一堆参数数据和代码,并不能运行,需要一个动力泵或是动力引擎将整个过程驱动起来,这就像人还缺一颗心脏一样,那人的血液就是filter graph 的数据流。
  • 这样 FFmpeg 就把驱动的能力交给了 filter 框架外面来做,通过向 filter graph 的首个 filter 推数据和从 filter graph 的末尾 filter 拉数据从而驱动整个 filter graph 的数据流动。

结构体简介


命令行使用

overlay

命令

ffmpeg -i file_copy.ts -i logo.png -filter_complex "[1:v]scale=100:100[logo];[0:v][logo]overlay=x=main_w-100:y=main_h-100" output.mp4

参数简记

  • -filter_complex:滤镜必选参数,后面跟滤镜命令
  • [1:v] :输入pin,表示视频的第1路
  • scale=100:100 :对[1:v]输入pin的处理,缩放成100:100
  • [logo] :输出pin
  • ; 每个滤镜分割
  • 0:v :两个输入,第一个视频,上一个滤镜的输出
  • overlay=x=main_w-100:y=main_h-100 :滤镜动作

效果

结构体认识

/** An instance of a filter */
struct AVFilterContext {const AVClass *av_class;        ///< needed for av_log() and filters common optionsconst AVFilter *filter;         ///< the AVFilter of which this is an instancechar *name;                     ///< name of this filter instanceAVFilterPad   *input_pads;      ///< array of input padsAVFilterLink **inputs;          ///< array of pointers to input linksunsigned    nb_inputs;          ///< number of input padsAVFilterPad   *output_pads;     ///< array of output padsAVFilterLink **outputs;         ///< array of pointers to output linksunsigned    nb_outputs;         ///< number of output padsvoid *priv;                     ///< private data for use by the filterstruct AVFilterGraph *graph;    ///< filtergraph this filter belongs to/*** Type of multithreading being allowed/used. A combination of* AVFILTER_THREAD_* flags.** May be set by the caller before initializing the filter to forbid some* or all kinds of multithreading for this filter. The default is allowing* everything.** When the filter is initialized, this field is combined using bit AND with* AVFilterGraph.thread_type to get the final mask used for determining* allowed threading types. I.e. a threading type needs to be set in both* to be allowed.** After the filter is initialized, libavfilter sets this field to the* threading type that is actually used (0 for no multithreading).*/int thread_type;/*** An opaque struct for libavfilter internal use.*/AVFilterInternal *internal;struct AVFilterCommand *command_queue;char *enable_str;               ///< enable expression stringvoid *enable;                   ///< parsed expression (AVExpr*)double *var_values;             ///< variable values for the enable expressionint is_disabled;                ///< the enabled state from the last expression evaluation/*** For filters which will create hardware frames, sets the device the* filter should create them in.  All other filters will ignore this field:* in particular, a filter which consumes or processes hardware frames will* instead use the hw_frames_ctx field in AVFilterLink to carry the* hardware context information.*/AVBufferRef *hw_device_ctx;/*** Max number of threads allowed in this filter instance.* If <= 0, its value is ignored.* Overrides global number of threads set per filter graph.*/int nb_threads;/*** Ready status of the filter.* A non-0 value means that the filter needs activating;* a higher value suggests a more urgent activation.*/unsigned ready;/*** Sets the number of extra hardware frames which the filter will* allocate on its output links for use in following filters or by* the caller.** Some hardware filters require all frames that they will use for* output to be defined in advance before filtering starts.  For such* filters, any hardware frame pools used for output must therefore be* of fixed size.  The extra frames set here are on top of any number* that the filter needs internally in order to operate normally.** This field must be set before the graph containing this filter is* configured.*/int extra_hw_frames;
};

ffmpeg-filter 入门相关推荐

  1. FFmpeg从入门到精通:SEI那些事

    本文是"FFmpeg从入门到精通"系列的第三篇,由金山云供稿,并授权LiveVideoStack发布.此前两篇为FFmpeg代码导读--基础篇和FFmpeg代码导读--HEVC在R ...

  2. FFmpeg从入门到入魔(2):保存流到本地MP4

    1 . FFmpeg裁剪移植 之前我们简单地讲解了下如何在Linux系统中编译FFmpeg,但是编译出来的so体积太大,而且得到的多个so不便于使用.本节在此基础上,将详细讲解在编译FFmpeg时如何 ...

  3. FFmpeg从入门到精通-云享读书会

    前言 FFmpeg是一款开源软件,用于生成处理多媒体数据的各类库和程序.FFmpeg可以转码.处理视频和图片(调整视频.图片大小,去噪等).打包.传输及播放视频.作为最受欢迎的视频和图像处理软件,它被 ...

  4. 1 FFmpeg从入门到精通-FFmpeg简介

    1 FFmpeg从入门到精通-FFmpeg简介 2 FFmpeg从入门到精通-FFmpeg工具使用基础 3 FFmpeg从入门到精通-FFmpeg转封装 4 FFmpeg从入门到精通-FFmpeg转码 ...

  5. 《FFmpeg从入门到精通》读书笔记(一)

    写在前面 最近在读<FFmpeg从入门到精通>这本书,结合着雷神的博客,学习音视频的知识- 在学习的过程中,也记录了一些摘要.因为是边看边记的,所以一些要点在看到后面的时候,需要反过来整理 ...

  6. Windows下FFmpeg高速入门

    本系列文章导航 Windows下FFmpeg高速入门 ffmpeg參数解释 mencoder和ffmpeg參数具体解释(Java处理视频) Java 生成视频缩略图(ffmpeg) 使用ffmpeg进 ...

  7. FFmpeg从入门到出家(HEVC在RTMP中的扩展)

    由金山云视频云技术团队提供:FFmpeg从入门到出家第三季: 为推进HEVC视频编码格式在直播方案中的落地,经过CDN联盟讨论,并和主流云服务厂商达成一致,规范了HEVC在RTMP/FLV中的扩展,具 ...

  8. FFmpeg Filter基本使用

    FFmpeg Filter基本使用 目录 FFmpeg filter简介 filter的使⽤⽅法 filter的语法 filterchain的语法 filtergraph的语法 基本结构 创建简单的滤 ...

  9. FFmpeg自学入门笔记

    命令行 PS:我自己使用过的命令行,便于自己查阅和使用FFmpeg. 1.转格式 ffmpeg -i input.mp4 output.avi 2.转分辨率 ffmpeg -i in.mp4 -vf ...

  10. FFMPEG filter使用实例(实现视频缩放,裁剪,水印等)

    本文转载自http://blog.csdn.net/li_wen01/article/details/62442162 FFMPEG官网给出了FFMPEG 滤镜使用的实例,它是将视频中的像素点替换成字 ...

最新文章

  1. 调用存储过程,名称,参数,类型都正确,但没有结果集的解决方法
  2. 使用Xtrabackup进行MySQL备份
  3. 查看oracle连接客户端
  4. python组合数据分类_Python 数据可视化:分类特征统计图
  5. 移植U-Boot思路和实践 | 基于RK3399
  6. 面试精讲之面试考点及大厂真题 - 分布式专栏 09 缓存必问:Reids持久化,高可用集群
  7. GPS各种地图坐标系转换(转载)
  8. android firefox 版本,Android版本Firefox初期预览版发布
  9. Flask 框架 是 Python 中最流行的 Web 框架之一
  10. ztree的树形结构不能正常显示原因
  11. leetcode之前K个高频元素
  12. mysql 全文所有_MySQL中的全文搜索
  13. android自动开关机软件,AutoOff(定时关机软件)
  14. 《晚明》小说各战役配图
  15. Synaptics没有“连接外部USB鼠标自动禁用”选项
  16. 软件公司使用XPlanner进行敏捷项目计划和进度跟踪管理
  17. [UE4] LogicDriver状态机基于管线(Conduit)的状态选择器
  18. 2019-2020记罗振宇“时间的朋友”跨年演讲(二)
  19. dell服务器新bois系统设置u盘启动,戴尔新版本的bios怎样设置U盘启动
  20. 校园二手交易平台毕设 校园二手商城毕业设计 毕设二手校园商品交易 二手商城系统 java二手交易市场 springboot商城 ssm二手交易平台下载 源代码+数据库+调试运行+讲解代码

热门文章

  1. install python-tk_No module named _tkinter, please install the python-tk package 解决方法总结
  2. Spring Data JPA 动态拼接条件的通用设计模式
  3. golang 项目设置后台运行
  4. pl/sql的存储过程
  5. 分账和无协议商户数据有误的处理过程
  6. Redis-Bitmap介绍及使用
  7. 【MyBatis框架】mybatis逆向工程自动生成代码
  8. Go 到底算不算一门面向对象的编程语言
  9. Laravel最佳实践--API请求频率限制(Throttle中间件)
  10. java解决限制访问指定url