ffmpeg Documentation-3 滤波器

本次内容为原官方文档的第三章,前文链接:
http://blog.csdn.net/leaf1990/article/details/53116471

附上官方文档第三章链接:
https://ffmpeg.org/ffmpeg-all.html#Detailed-description

3.1 Filtering
滤波器
Before encoding, ffmpeg can process raw audio and video frames using filters from the libavfilter library.
在编码之前,ffmpeg可以使用libavfilter库中的滤波器处理原始音频和视频帧。
这里写图片描述
Several chained filters form a filter graph. ffmpeg distinguishes between two types of filtergraphs: simple and complex.
几个链接的过滤器则形成过滤器图。ffmpeg区分两种类型的过滤器图:简单和复杂。

3.1.1 简单滤波
Simple filtergraphs are those that have exactly one input and output, both of the same type. In the above diagram they can be represented by simply inserting an additional step between decoding and encoding:
这里写图片描述
简单的滤波器仅支持一个输入流和一个输出流,且要求两者都是相同类型。 如上图所示,简单滤波过程可理解为在解码和编码之间插入附加步骤。
Simple filtergraphs are configured with the per-stream -filter option (with -vf and -af aliases for video and audio respectively). A simple filtergraph for video can look for example like this:
通过在流名前加 -filter选项来应用滤波处理,如-vf表示单为视频加滤波处理,-af表示单为音频加滤波处理。
一个简单的视频滤镜可以看起来像这样:
这里写图片描述
Note that some filters change frame properties but not frame contents.
注意:某些滤波处理过程仅改变了帧属性,但不改变帧内容。
E.g. the fps filter in the example above changes number of frames, but does not touch the frame contents.
如前面提到的的fps滤波仅改变了每秒的帧数量,但没有改变每一帧的内容。
Another example is the setpts filter, which only sets timestamps and otherwise passes the frames unchanged.
而setpts滤波则仅仅改变了时间戳,帧内容则保持不变。

3.1.2 复杂滤波
Complex filtergraphs are those which cannot be described as simply a linear processing chain applied to one stream.
复杂滤波器则不能简单地描述为单个流上解码和编码之间的一个线性处理链。
This is the case, for example, when the graph has more than one input and/or output, or when output stream type is different from input. They can be represented with the following diagram:
例如,当有多个输入,或者当输出流类型与输入流类型不同时,它们可以用下面的图表示:
3-4
Complex filtergraphs are configured with the -filter_complex option. Note that this option is global,
复杂滤镜通过-filter_complex选项配置。
since a complex filtergraph, by its nature, cannot be unambiguously associated with a single stream or file.
请注意,此选项是全局的,因为复杂的过滤器从原则上就不能明确地与单个流或文件相关联。
The -lavfi option is equivalent to -filter_complex.
-lavfi选项等效于-filter_complex。

A trivial example of a complex filtergraph is the overlay filter, which has two video inputs and one video output, containing one video overlaid on top of the other. Its audio counterpart is the amix filter.
以overlay滤波器为例,它需要包含两个输入视频和一个输出视频,作用是将输入视频中的一个叠加到另一个输入视频上,然后输出成一个视频。它所对应的音频滤波器是amix选项。

3.2 Stream Copy
3.2 流拷贝
Stream copy is a mode selected by supplying the copy parameter to the -codec option.
流拷贝是将-codec选项设置为copy的一种滤波器模式。
It makes ffmpeg omit the decoding and encoding step for the specified stream, so it does only demuxing and muxing.
在流拷贝模式下,ffmpeg跳过了流解码和编码步骤,而只是进行多路复用和多路分解。
It is useful for changing the container format or modifying container-level metadata. The diagram above will, in this case, simplify to this:
它对于更改容器格式或修改容器元数据比较有用。在这种模式下的工作图如下:
这里写图片描述

Since there is no decoding or encoding, it is very fast and there is no quality loss.
因为流拷贝模式下不需要解码和编码,所以处理过程十分快速并且没有质量损失。
However, it might not work in some cases because of many factors.
然而,因为各种原因,这种模式在某些场合并不能产生正确结果。
Applying filters is obviously also impossible, since filters work on uncompressed data.
同理,在此模式下是无法使用滤波器的,因为滤波是处理的未压缩数据。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值