我有一个包含 8 个 channel 的 24 位 WAV 文件。我需要做的是将其转换为 4 24 位两个 channel 文件,其中输出 wav 由源 channel (1,2)、(3,4)、(5,6)、(7,8) 组成。
有人知道使用 FFmpeg 实现这一点的最佳方法吗?
最佳答案
请参阅 ffmpeg docs 中的 -map 和 map_channel :
‘-map [-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]] | [linklabel] (output)’
Designate one or more input streams as a source for the output file. Each input stream is identified by the input file index input_file_id and the input stream index input_stream_id within the input file. Both indices start at 0. If specified, sync_file_id:stream_specifier sets which input stream is used as a presentation sync reference.
The first -map option on the command line specifies the source for output stream 0, the second -map option specifies the source for output stream 1, etc.
A - character before the stream identifier creates a "negative" mapping. It disables matching streams from already created mappings.
An alternative [linklabel] form will map outputs from complex filter graphs (see the ‘-filter_complex’ option) to the output file. linklabel must correspond to a defined output link label in the graph.
和map_channel:
‘-map_channel [input_file_id.stream_specifier.channel_id|-1][:output_file_id.stream_specifier]’
Map an audio channel from a given input to an output. If output_file_id.stream_specifier is not set, the audio channel will be mapped on all the audio streams.
Using "-1" instead of input_file_id.stream_specifier.channel_id will map a muted channel.
关于FFMPEG channel 映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12319129/