Changes between Version 30 and Version 31 of AudioChannelManipulation
- Timestamp:
- Jan 22, 2019, 4:13:02 AM (4 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AudioChannelManipulation
v30 v31 34 34 [[Image(stereo_mono_exclude.png, nolink)]] 35 35 36 This example uses the [https://ffmpeg.org/ffmpeg-filters.html#pan pan] audio filter to include only the right channel: 36 This example uses the [https://ffmpeg.org/ffmpeg-filters.html#channelsplit channelsplit] audio filter to include only the right channel: 37 38 {{{ 39 ffmpeg -i stereo.wav -filter_complex "[0:a]channelsplit=channel_layout=stereo:channels=FR[right]" -map "[right]" front_right.wav 40 }}} 41 42 * If you only want the left channel use `FL` instead of `FR`. See `ffmpeg -layouts` for a list of channel names. 43 44 Example using the [https://ffmpeg.org/ffmpeg-filters.html#pan pan] audio filter: 37 45 38 46 {{{ … … 40 48 }}} 41 49 42 If you only want the left channel use `c0=c0` instead. 50 * Alternatively, you could use `c0=FR` instead. 51 * If want the left channel instead use `c0=c0` or `c0=FL`. 52 43 53 44 54 = stereo → 2 × mono files = … … 46 56 [[Image(stereo_2mono_outputs.png, nolink)]] 47 57 48 Output each channel in stereo input to individual mono files: 58 Output each channel in stereo input to individual mono files with the [https://ffmpeg.org/ffmpeg-filters.html#channelsplit channelsplit] audio filter: 59 60 {{{ 61 ffmpeg -i stereo.wav -filter_complex "[0:a]channelsplit=channel_layout=stereo[left][right]" -map "[left]" left.wav -map "[right]" right.wav 62 }}} 63 64 or with the `-map_channel` option: 49 65 50 66 {{{ … … 65 81 66 82 {{{ 67 ffmpeg -i in.mp3 -filter_complex channelsplit=channel_layout=stereo out.mka83 ffmpeg -i in.mp3 -filter_complex "[0:a]channelsplit=channel_layout=stereo" output.mka 68 84 }}} 69 85 … … 86 102 87 103 {{{ 88 ffmpeg -i input.mp3 -filter_complex "[0:a][0:a]amerge=inputs=2[a out]" -map "[aout]" output.m4a104 ffmpeg -i input.mp3 -filter_complex "[0:a][0:a]amerge=inputs=2[a]" -map "[a]" output.m4a 89 105 }}} 90 106 … … 101 117 102 118 {{{ 103 ffmpeg -i left.mp3 -i right.mp3 -filter_complex "[0:a][1:a]amerge=inputs=2[a out]" -map "[aout]" output.mka119 ffmpeg -i left.mp3 -i right.mp3 -filter_complex "[0:a][1:a]amerge=inputs=2[a]" -map "[a]" output.mka 104 120 }}} 105 121 … … 112 128 {{{ 113 129 ffmpeg -i front_left.wav -i front_right.wav -i front_center.wav -i lfe.wav -i back_left.wav -i back_right.wav \ 114 -filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[a out]" -map "[aout]" output.wav130 -filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[a]" -map "[a]" output.wav 115 131 }}} 116 132 … … 121 137 [[Image(5point1_6mono.png, nolink)]] 122 138 123 Split a 5.1 channel input into individual per-channel files :139 Split a 5.1 channel input into individual per-channel files using the [https://ffmpeg.org/ffmpeg-filters.html#channelsplit channelsplit] audio filter: 124 140 125 141 {{{ … … 152 168 }}} 153 169 154 If you want to map specific channels and drop the rest you can use the [https://ffmpeg.org/ffmpeg-filters.html#pan pan audio filter]. This will map the `FL` (Front Left) of the input to the `FL` of the output, and the `FR` (Front Right) of the input to the `FR` of the output:170 If you want to map specific channels and drop the rest you can use the [https://ffmpeg.org/ffmpeg-filters.html#pan pan] audio filter. This will map the `FL` (Front Left) of the input to the `FL` of the output, and the `FR` (Front Right) of the input to the `FR` of the output: 155 171 156 172 {{{ … … 173 189 174 190 {{{ 175 ffmpeg -i input1.wav -i input2.wav -filter_complex "[0:a][1:a]amerge=inputs=2,pan=stereo|c0<c0+c2|c1<c1+c3[a out]" -map "[aout]" output.mp3191 ffmpeg -i input1.wav -i input2.wav -filter_complex "[0:a][1:a]amerge=inputs=2,pan=stereo|c0<c0+c2|c1<c1+c3[a]" -map "[a]" output.mp3 176 192 }}} 177 193 … … 179 195 180 196 {{{ 181 ffmpeg -i input1.wav -i input2.wav -filter_complex "[0:a][1:a]amerge=inputs=2[a out]" -map "[aout]" -ac 2 output.mp3197 ffmpeg -i input1.wav -i input2.wav -filter_complex "[0:a][1:a]amerge=inputs=2[a]" -map "[a]" -ac 2 output.mp3 182 198 }}} 183 199 … … 193 209 Just change the channel specifications in the pan filter: 194 210 {{{ 195 ffmpeg -i input1.wav -i input2.wav -filter_complex "[0:a][1:a]amerge=inputs=2,pan=stereo|c0<c0+c1|c1<c2+c3[a out]" -map "[aout]" output.mp3211 ffmpeg -i input1.wav -i input2.wav -filter_complex "[0:a][1:a]amerge=inputs=2,pan=stereo|c0<c0+c1|c1<c2+c3[a]" -map "[a]" output.mp3 196 212 }}} 197 213 … … 212 228 [[Image(switch_stereo_channels.png, nolink)]] 213 229 214 Switch left channel to right and right channel to left: 230 Switch left channel to right and right channel to left with the [https://ffmpeg.org/ffmpeg-filters.html#pan pan] audio filer: 231 232 {{{ 233 ffmpeg -i stereo.ogg -af pan=stereo|c0=c1|c1=c0 output.wav 234 }}} 235 236 or with `-map_channel`: 215 237 216 238 {{{ … … 218 240 }}} 219 241 220 or with the [https://ffmpeg.org/ffmpeg-filters.html#pan pan] audio filer: 221 222 {{{ 223 ffmpeg -i stereo.ogg -af pan=stereo|c0=c1|c1=c0 output.wav 224 }}} 242 ---- 243 244 = Mute a channel = 245 246 [[Image(mute_stereo_channel.png, nolink)]] 247 248 This example uses the [https://ffmpeg.org/ffmpeg-filters.html#pan pan] audio filter to mute the first channel (front left) but keep the second channel (front right) as is: 249 250 {{{ 251 ffmpeg -i stereo.wav -af "pan=stereo|c1=c1" output.wav 252 }}} 253 254 Example using the `-map_channel` option: 255 256 {{{ 257 ffmpeg -i stereo.wav -map_channel -1 -map_channel 0.0.1 output.wav 258 }}} 259 260 ---- 225 261 226 262 = Virtual Binaural Acoustics = 227 263 228 FFmpeg can produce virtual binaural acoustics files using sofalizer filter, 229 most known channel layouts are supported for input, output is always stereo. 264 FFmpeg can produce virtual binaural acoustics files using the [https://ffmpeg.org/ffmpeg-filters.html#sofalizer sofalizer] audio filter. Most known channel layouts are supported for the input, and the output is always stereo. 230 265 231 266 {{{ … … 233 268 }}} 234 269 235 SOFA files can be found on http://sofacoustics.org/data/database/ari/236 237 ---- 238 239 = Mu te a channel=240 241 [[Image(mute_stereo_channel.png, nolink)]] 242 243 This example will mute the first channel (the left channel) but keep the second channel as is: 244 245 {{{ 246 ffmpeg -i stereo.wav -map_channel -1 -map_channel 0.0.1 output.wav 247 }}} 270 SOFA files can be found at [https://sofacoustics.org/data/database/ari/ sofacoustics.org]. 271 272 ---- 273 274 = Multiple channel layouts = 275 276 This example combines two layouts (5.1+2.0) into a single arbitrary layout using the [https://ffmpeg.org/ffmpeg-filters.html#pan pan] audio filter: 277 278 {{{ 279 ffmpeg -i input -filter_complex "pan=5.1+downmix|FL=c0|FR=c1|FC=c2|LFE=c3|BL=c4|BR=c5|DL=c6|DR=c7[a]" -map "[a]" out.wav 280 }}} 281 282 The output in the example resulted in one audio stream with 8 channels. 248 283 249 284 ---- … … 251 286 = Statistics = 252 287 253 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:288 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: 254 289 255 290 {{{ … … 293 328 ---- 294 329 295 = L ayouts =330 = List channel names and standard channel layouts = 296 331 297 332 Output from `ffmpeg -layouts`: … … 299 334 {{{ 300 335 Individual channels: 301 NAME DESCRIPTION302 FL front left303 FR front right304 FC front center305 LFE low frequency306 BL back left307 BR back right308 FLC front left-of-center309 FRC front right-of-center310 BC back center311 SL side left312 SR side right313 TC top center314 TFL top front left315 TFC top front center316 TFR top front right317 TBL top back left318 TBC top back center319 TBR top back right320 DL downmix left321 DR downmix right322 WL wide left323 WR wide right324 SDL surround direct left325 SDR surround direct right326 LFE2 low frequency 2336 NAME DESCRIPTION 337 FL front left 338 FR front right 339 FC front center 340 LFE low frequency 341 BL back left 342 BR back right 343 FLC front left-of-center 344 FRC front right-of-center 345 BC back center 346 SL side left 347 SR side right 348 TC top center 349 TFL top front left 350 TFC top front center 351 TFR top front right 352 TBL top back left 353 TBC top back center 354 TBR top back right 355 DL downmix left 356 DR downmix right 357 WL wide left 358 WR wide right 359 SDL surround direct left 360 SDR surround direct right 361 LFE2 low frequency 2 327 362 328 363 Standard channel layouts: … … 357 392 downmix DL+DR 358 393 }}} 359 360 == Multiple channel layouts. ==361 I had to do 5.1+2.0 in a single WAV file. If you use 2 channel layouts in a Pan filter to do that, it looks like this =362 {{{363 pan=5.1+downmix|FL=c0|FR=c1|FC=c2|LFE=c3|BL=c4|BR=c5|DL=c6|DR=c7.364 }}}365 That way, 8 channels in 1 WAV file has all the channels you need.