Changes between Version 32 and Version 33 of AudioChannelManipulation


Ignore:
Timestamp:
Jun 27, 2020, 3:54:29 AM (2 weeks ago)
Author:
tarxvf
Comment:

Added an example to better illustrate how to merge and map multiple streams. It's less focused compared to other examples, but it was not obvious to me how to do it because all existing relevant examples were too trivial.

Legend:

Unmodified
Added
Removed
Modified
  • AudioChannelManipulation

    v32 v33  
    312312
    313313The output in the example resulted in one audio stream with 8 channels.
     314
     315----
     316
     317= Merged and mapped audio channels =
     318
     319This is born from screencasting, where you might want to record an interview over teleconference and still be able to isolate the audio streams to better deal with background noise later in post-processing.
     320
     321This example outputs a video with three audio options: the merged speaker+microphone streams, the speaker stream alone, and the microphone stream alone.
     322
     323x11grab provides stream 0, and is video only.
     324
     325stream 1 is the pulse "audio monitor", or what the speakers are playing.
     326
     327stream 2 is the pulseaudio default audio input device, meant to be a microphone, and in this case, stereo.
     328
     329"[a]" is the generated stream from merging stream 1 and stream 2, using amerge and then pan to retain stereo channels instead of 4.0 channels as seen above in "2 × stereo → stereo".
     330
     331These streams are then mapped in the order desired.
     332
     333
     334
     335{{{
     336#for "-f pulse -i 0", 0 is the pulseaudio id
     337#of the audio that is going to the speakers
     338#as determined from "pacmd list-sources"
     339ffmpeg -video_size 1920x1080 -framerate 60 \
     340  -f x11grab -i :0.0 \
     341  -f pulse -i 0 \
     342  -f pulse -i default \
     343  -filter_complex "[1:a][2:a] amerge=inputs=2,pan=stereo|c0<c0+c2|c1<c1+c3[a]" \
     344  -map 0 \
     345  -map "[a]" \
     346  -map 1 \
     347  -map 2 \
     348  -c:v libx264 -crf 17 -preset ultrafast  \
     349  output_filename.mkv
     350
     351}}}
    314352
    315353----