Changes between Version 26 and Version 27 of AudioChannelManipulation
- Timestamp:
- Nov 28, 2017, 1:52:25 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AudioChannelManipulation
v26 v27 1 = Manipulating audio channels with `ffmpeg` = 2 3 [[PageOutline(2, Contents)]] 4 5 == stereo → mono stream == 1 {{{ 2 #!html 3 <h1 style="font-size: 22px;"> 4 Manipulating audio channels 5 </h1> 6 }}} 7 8 [[PageOutline(1, Contents)]] 9 10 = stereo → mono stream = 11 12 == Downmix both channels == 6 13 7 14 [[Image(stereo_mono.png, nolink)]] … … 13 20 }}} 14 21 15 Note: Any out of phase stereo will cancel out. 16 17 == stereo → 2 × mono files == 22 {{{ 23 #!div style="border: 1px solid #e5c7c7; margin: 1em; background-color: #fdd;" 24 '''Warning:''' Any out of phase stereo will cancel out. 25 }}} 26 27 == Choose a specific channel == 28 29 [[Image(stereo_mono_exclude.png, nolink)]] 30 31 This example uses the [https://ffmpeg.org/ffmpeg-filters.html#pan pan] audio filter to include only the right channel: 32 33 {{{ 34 ffmpeg -i stereo.wav -af "pan=mono|c0=c1" mono.m4a 35 }}} 36 37 If you only want the left channel use `c0=c0` instead. 38 39 = stereo → 2 × mono files = 18 40 19 41 [[Image(stereo_2mono_outputs.png, nolink)]] … … 28 50 29 51 {{{ 30 ffmpeg -i stereo.wav -filter_complex "[0: 0]pan=1c|c0=c0[left];[0:0]pan=1c|c0=c1[right]" -map "[left]" left.wav -map "[right]" right.wav31 }}} 32 33 = = stereo → 2 × mono streams ==52 ffmpeg -i stereo.wav -filter_complex "[0:a]pan=1c|c0=c0[left];[0:0]pan=1c|c0=c1[right]" -map "[left]" left.wav -map "[right]" right.wav 53 }}} 54 55 = stereo → 2 × mono streams = 34 56 35 57 [[Image(stereo_2mono_streams.png, nolink)]] … … 42 64 43 65 {{{ 44 #!div style="border: 1p t dotted; margin: 1em; background-color: #ffffdd;"66 #!div style="border: 1px solid #e5e5c7; margin: 1em; background-color: #ffd;" 45 67 '''Note:''' Your player will likely play the first stream by default unless your player allows you to select the desired stream. 46 68 }}} 47 69 48 = = mono → stereo ==70 = mono → stereo = 49 71 50 72 [[Image(mono_stereo.png, nolink)]] … … 63 85 64 86 {{{ 65 #!div style="border: 1p t dotted; margin: 1em; background-color: #ffffdd;"87 #!div style="border: 1px solid #e5e5c7; margin: 1em; background-color: #ffd;" 66 88 '''Note:''' These examples will not magically create a "true" stereo output from the mono input, but simply place the same audio into both the left and right channels of the output (both channels will be identical). 67 89 }}} 68 90 69 = = 2 × mono → stereo ==91 = 2 × mono → stereo = 70 92 71 93 [[Image(2mono_stereo.png, nolink)]] … … 77 99 }}} 78 100 79 = = 6 × mono → 5.1 ==101 = 6 × mono → 5.1 = 80 102 81 103 [[Image(6mono_5point1.png, nolink)]] … … 90 112 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. 91 113 92 = = 5.1 → 6 × mono114 = 5.1 → 6 × mono = 93 115 94 116 [[Image(5point1_6mono.png, nolink)]] … … 108 130 109 131 110 = = 5.1 → stereo ==132 = 5.1 → stereo = 111 133 112 134 [[Image(5point1_stereo.png, nolink)]] … … 119 141 120 142 {{{ 121 #!div style="border: 1p t dotted; margin: 1em; background-color: #ffffdd;"143 #!div style="border: 1px solid #e5e5c7; margin: 1em; background-color: #ffd;" 122 144 '''Notes:''' 123 145 * By default when using `-ac 2` the LFE channel is omitted. See "[http://atsc.org/wp-content/uploads/2015/03/A52-201212-17.pdf Digital Audio Compression Standard (Document A/52:2012)]", sections 6.1.12 and 7.8 for more downmixing info. … … 139 161 If the `=` in a channel specification is replaced by `<`, then the gains for that specification will be renormalized so that the total is 1, thus avoiding clipping noise. See the [https://ffmpeg.org/ffmpeg-filters.html#pan pan audio filter documentation] for additional information and examples. 140 162 141 = = 2 × stereo → stereo ==163 = 2 × stereo → stereo = 142 164 143 165 [[Image(2stereo_stereo.png, nolink)]] … … 156 178 157 179 {{{ 158 #!div style="border: 1p t dotted; margin: 1em; background-color: #ffffdd;"180 #!div style="border: 1px solid #e5e5c7; margin: 1em; background-color: #ffd;" 159 181 '''Note:''' The output produced with the pan audio filter may not be identical to the output produced with `-ac 2`, so you'll have to listen to your outputs or view [#Statistics audio statistics] to determine which output suits you. 160 182 }}} … … 171 193 The pan audio filter has to be used in this situation instead of `-ac 2` unlike the previous example. 172 194 173 = = Mix both stereo channels to stereo ==195 = Mix both stereo channels to stereo = 174 196 175 197 [[Image(stereo_stereo_mix.png, nolink)]] … … 181 203 }}} 182 204 183 = = Switch stereo channels ==205 = Switch stereo channels = 184 206 185 207 [[Image(switch_stereo_channels.png, nolink)]] … … 197 219 }}} 198 220 199 = = Virtual Binaural Acoustics ==221 = Virtual Binaural Acoustics = 200 222 201 223 FFmpeg can produce virtual binaural acoustics files using sofalizer filter, … … 210 232 ---- 211 233 212 = = Mute a channel ==234 = Mute a channel = 213 235 214 236 [[Image(mute_stereo_channel.png, nolink)]] … … 222 244 ---- 223 245 224 = = Statistics ==246 = Statistics = 225 247 226 248 The [https://ffmpeg.org/ffmpeg-filters.html#astats astats audio filter] can display information including length, DC offset, min/max levels, peak/RMS level dB: … … 266 288 ---- 267 289 268 = = Layouts ==290 = Layouts = 269 291 270 292 Output from `ffmpeg -layouts`:
