ffmpeg Documentation-4&5 Stream selection and specifiers

ffmpeg官方文档第4章和第5.1章

官方文档链接:https://ffmpeg.org/ffmpeg-all.html#Options

4 Stream selection
4 流选择
By default, ffmpeg includes only one stream of each type (video, audio, subtitle) present in the input files and adds them to each output file.
默认地,在有多个输入文件的情况下,ffmpeg在每种类型(视频、音频和字幕)的文件中挑选一路输出到输出文件中。
It picks the “best” of each based upon the following criteria:
它根据以下标准选择每个类型中的“最好”:
for video, it is the stream with the highest resolution,
在视频中,选择分辨率最高的
for audio, it is the stream with the most channels,
在音频中,选择通道最多的
for subtitles, it is the first subtitle stream.
在字幕中,选择第一路字幕
In the case where several streams of the same type rate equally, the stream with the lowest index is chosen.
在相同类型的几个流速率相同的情况下,一般选择具有最低索引的流。

You can disable some of those defaults by using the -vn/-an/-sn/-dn options.
可以通过-vn/-an/-sn/-dn options取消这些默认值。
For full manual control, use the -map option, which disables the defaults just described.
若想要完全的人为控制,可以通过 -map选项实现,此选项禁用了上面描述的默认值。

5 Options
5 选项
All the numerical options, if not specified otherwise, accept a string representing a number as input, which may be followed by one of the SI unit prefixes, for example: ’K’, ’M’, or ’G’.
如果没有特别指明,所有的数值选项,都接收字符串形式的数值,其后面可以是SI单位前缀之一,例如:’K’,’M’或’G’。

If ’i’ is appended to the SI unit prefix, the complete prefix will be interpreted as a unit prefix for binary multiples, which are based on powers of 1024 instead of powers of 1000.
Appending ’B’ to the SI unit prefix multiplies the value by 8. This allows using, for example: ’KB’, ’MiB’, ’G’ and ’B’ as number suffixes.
如果’i’被附加到SI单位前缀,则完整的前缀将被解释为二进制倍数的单位前缀,即其基于1024的幂而不是1000的幂。
将“B”附加到SI单位前缀将该值乘以8.这允许使用例如:’KB’,’MiB’,’G’和’B’作为数字后缀。

Options which do not take arguments are boolean options, and set the corresponding value to true.
不带参数的选项是布尔选项,默认值为true。
They can be set to false by prefixing the option name with “no”. For example using “-nofoo” will set the boolean option with name “foo” to false.
如果要设置布尔选项为false,可以在选项前加上’no’关键字。如,nofoo表示设置foo选项为false。

5.1 Stream specifiers
5.1 流指定符
Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers are used to precisely specify which stream(s) a given option belongs to.
默认情况下, 选项作用于其后的流,如 bitrate选项和codec选项。流指定符则用于精确指出选项作用于哪个流。

A stream specifier is a string generally appended to the option name and separated from it by a colon. E.g. -codec:a:1 ac3 contains the a:1 stream specifier, which matches the second audio stream.
Therefore, it would select the ac3 codec for the second audio stream.
流说明符是一个字符串,通常附加到选项名称后并用冒号分隔。如 -codec:a:1 ac3 包含流指定符 a:1,它明确指定选项作用于第二个音频流。因此,-codec:a:1 ac3的作用是设置第二个音频流的编解码器为 ac3.

A stream specifier can match several streams, so that the option is applied to all of them. E.g. the stream specifier in -b:a 128k matches all audio streams.
一个流指定符可同时匹配多个流,因此选项也可作用于所有匹配到的流。如 -b:a 128k 指定符的作用是 设置所有音频流的bitrate为128k.

An empty stream specifier matches all streams. For example, -codec copy or -codec: copy would copy all the streams without reencoding.
空流指定符匹配所有流。如,-codec copy 或 -codec: copy 的作用是在跳过编解码阶段的情况下拷贝所有流。

Possible forms of stream specifiers are:
流标识符的可能形式有:
stream_index
Matches the stream with this index. E.g. -threads:1 4 would set the thread count for the second stream to 4.
流索引符:匹配指定索引的流,如-threads:1 4指定符,将第二路流的线程计数设置为4.

stream_type[:stream_index]
stream_type is one of following: ’v’ or ’V’ for video, ’a’ for audio, ’s’ for subtitle, ’d’ for data, and ’t’ for attachments. ’v’ matches all video streams, ’V’ only matches video streams which are not attached pictures, video thumbnails or cover arts. If stream_index is given, then it matches stream number stream_index of this type. Otherwise, it matches all streams of this type.
流类型符:’v’ or ’V’表示视频流,’a’ 表示音频, ’s’ 表示字幕, ’d’ for 数据, and ’t’ for 附件.通常小写的’v’匹配所有视频流,而大写的‘V’仅匹配未附加图片,视频缩略图或封面艺术的视频流,如果流索引stream_index给出,则它匹配该类型指定索引的流。否则匹配所有这种类型的流。

****p:program_id[:stream_index]
If stream_index is given, then it matches the stream with number stream_index in the program with the id program_id. Otherwise, it matches all streams in the program.**

stream_id or i:stream_id

Match the stream by stream id (e.g. PID in MPEG-TS container).
流ID匹配符:通过流id匹配流(例如MPEG-TS容器中的PID)

m:key[:value]
Matches streams with the metadata tag key having the specified value. If value is not given, matches streams that contain the given tag with any value.
匹配具有指定键和值的标记的流。 如果未指定值,则将返回包含指定键的流。

u
Matches streams with usable configuration, the codec must be defined and the essential information such as video dimension or audio sample rate must be present.
匹配具有可用配置的流,必须定义编解码器,其他基本信息如视频尺寸或音频采样率也必须存在。

Note that in ffmpeg, matching by metadata will only work properly for input files.
请注意,在ffmpeg中,通过元数据进行的匹配仅适用于输入文件。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值