Changes between Version 31 and Version 32 of AudioChannelManipulation


Ignore:
Timestamp:
Feb 6, 2019, 1:58:22 AM (2 weeks ago)
Author:
llogan
Comment:

added some join and channelmap examples

Legend:

Unmodified
Added
Removed
Modified
  • AudioChannelManipulation

    v31 v32  
    114114[[Image(2mono_stereo.png, nolink)]]
    115115
    116 Create a stereo output from two mono inputs with the [https://ffmpeg.org/ffmpeg-filters.html#amerge amerge] audio filter:
     116Create a stereo output from two mono inputs with the [https://ffmpeg.org/ffmpeg-filters.html#join join] audio filter:
     117
     118{{{
     119ffmpeg -i left.mp3 -i right.mp3 -filter_complex "[0:a][1:a]join=inputs=2:channel_layout=stereo[a]" -map "[a]" output.mp3
     120}}}
     121
     122or the [https://ffmpeg.org/ffmpeg-filters.html#amerge amerge] audio filter:
    117123
    118124{{{
     
    124130[[Image(6mono_5point1.png, nolink)]]
    125131
    126 Combine 6 mono inputs into one 5.1 (6 channel) output with the [https://ffmpeg.org/ffmpeg-filters.html#amerge amerge] audio filter:
     132Combine 6 mono inputs into one 5.1 (6 channel) output with the [https://ffmpeg.org/ffmpeg-filters.html#join join] audio filter:
     133
     134{{{
     135ffmpeg -i front_left.wav -i front_right.wav -i front_center.wav -i lfe.wav -i back_left.wav -i back_right.wav \
     136-filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]join=inputs=6:channel_layout=5.1[a]" -map "[a]" output.wav
     137}}}
     138
     139The join audio filter also allows you to manually choose the layout:
     140
     141{{{
     142ffmpeg -i front_left.wav -i front_right.wav -i front_center.wav -i lfe.wav -i back_left.wav -i back_right.wav \
     143-filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-LFE|4.0-BL|5.0-BR[a]" -map "[a]" output.wav
     144}}}
     145
     146Another method using the [https://ffmpeg.org/ffmpeg-filters.html#amerge amerge] audio filter which is somewhat less flexible than the join filter shown above:
    127147
    128148{{{
     
    131151}}}
    132152
    133 All inputs must have the same sample rate and format. If inputs do not have the same duration the output will stop with the shortest.
     153With amerge all inputs must have the same sample rate and format. If inputs do not have the same duration the output will stop with the shortest.
    134154
    135155= 5.1 → 6 × mono =
     
    150170}}}
    151171
    152 
    153172= 5.1 → stereo =
    154173
     
    228247[[Image(switch_stereo_channels.png, nolink)]]
    229248
    230 Switch left channel to right and right channel to left with the [https://ffmpeg.org/ffmpeg-filters.html#pan pan] audio filer:
     249Switch left channel to right and right channel to left with the [https://ffmpeg.org/ffmpeg-filters.html#channelmap channelmap] audio filter:
     250
     251{{{
     252ffmpeg -i stereo.mp3 -filter_complex "channelmap=map=FL-FR|FR-FL:channel_layout=stereo" output.mp3
     253}}}
     254
     255Or with the [https://ffmpeg.org/ffmpeg-filters.html#pan pan] audio filer:
    231256
    232257{{{
     
    240265}}}
    241266
    242 ----
    243 
    244267= Mute a channel =
    245268
     
    256279{{{
    257280ffmpeg -i stereo.wav -map_channel -1 -map_channel 0.0.1 output.wav
     281}}}
     282
     283= Remap channels =
     284
     285The [https://ffmpeg.org/ffmpeg-filters.html#channelmap channelmap] audio filter can re-arrange the channel layout. For example, to switch the FL and FR channels in a 5.1 input:
     286
     287{{{
     288ffmpeg -i input.wav -filter_complex "channelmap=map=FL-FR|FR-FL|FC-FC|LFE-LFE|BL-BL|BR-BR:channel_layout=5.1" output.wav
    258289}}}
    259290