title: How map_channel works in ffmpeg?
body: <p>I need to extract channels from 5.1 audios. These audio tracks are contained in a MKV file. Structure of &quot;movie.mkv&quot; file is like this:</p>
  <pre><code>Input #0, matroska,webm, from 'movie.mkv':
    Duration: 00:40:38.08, start: 0.000000, bitrate: 21128 kb/s
      Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x800 [SAR 1:1 DAR 12:5], 24 fps, 24 tbr, 1k tbn, 48 tbc
      Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
      Stream #0:2(ger): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s
      Stream #0:3(eng): Subtitle: subrip
  </code></pre>
  <p>But the syntax is very messy, so I did not figure out how to extract channels properly.</p>
  <p>This code, for the first audio track, works fine:</p>
  <pre><code>ffmpeg -i &quot;movie.mkv&quot; -map_channel 0.1.0 &quot;eng channel 1.wav&quot;
  ffmpeg -i &quot;movie.mkv&quot; -map_channel 0.1.1 &quot;eng channel 2.wav&quot;
  ffmpeg -i &quot;movie.mkv&quot; -map_channel 0.1.2 &quot;eng channel 3.wav&quot;
  ffmpeg -i &quot;movie.mkv&quot; -map_channel 0.1.3 &quot;eng channel 4.wav&quot;
  ffmpeg -i &quot;movie.mkv&quot; -map_channel 0.1.4 &quot;eng channel 5.wav&quot;
  ffmpeg -i &quot;movie.mkv&quot; -map_channel 0.1.5 &quot;eng channel 6.wav&quot;
  </code></pre>
  <p>I believe that <strong>0.1.0</strong> is: input #0 (movie.mkv); then stream 1 (audio eng); then channel 0 (very first channel).</p>
  <p>But when I'm trying to extract channels from second audio track...</p>
  <pre><code>ffmpeg -i &quot;movie.mkv&quot; -map_channel 0.2.0 &quot;ger channel 1.wav&quot;
  ffmpeg -i &quot;movie.mkv&quot; -map_channel 0.2.1 &quot;ger channel 2.wav&quot;
  ffmpeg -i &quot;movie.mkv&quot; -map_channel 0.2.2 &quot;ger channel 3.wav&quot;
  ffmpeg -i &quot;movie.mkv&quot; -map_channel 0.2.3 &quot;ger channel 4.wav&quot;
  ffmpeg -i &quot;movie.mkv&quot; -map_channel 0.2.4 &quot;ger channel 5.wav&quot;
  ffmpeg -i &quot;movie.mkv&quot; -map_channel 0.2.5 &quot;ger channel 6.wav&quot;
  </code></pre>
  <p>...it extracts not German sound, but instead it results with the same eng channels (which also sound little louder than in previous case). In this code, <strong>0.2.0</strong> appears to be: input #0 (movie.mkv); then stream 2 (audio ger); then channel 0 (very first channel).</p>
  <p>So what am I doing wrong? :-)</p>