Body: <p>I have a file that has one video stream and one audio stream with 8 channels. I want to create a new file that will only contain the first 2 channels of the audio stream (no video). I can do this using the <a href="https://ffmpeg.org/ffmpeg-filters.html#pan" rel="nofollow">pan filter</a>. I also want to clip the file. I can do this using the <a href="https://www.ffmpeg.org/ffmpeg.html#toc-Main-options" rel="nofollow">-ss and -t options</a>. However, when I try to do both together, I get an error.</p>
  
  <p>So, if I run:</p>
  
  <pre><code>ffmpeg -i a.mov -filter_complex "[0:1]pan=2c|c0=c0|c1=c1[stereo]" -map "[stereo]" "a.audio.mov"
  </code></pre>
  
  <p>It works fine - I get the audio file with the correct channels.</p>
  
  <p>But when I run:</p>
  
  <pre><code>ffmpeg -i a.mov -filter_complex "[0:1]pan=2c|c0=c0|c1=c1[stereo]" -map "[stereo]" -ss 00:00:01 "a.audio.mov"
  </code></pre>
  
  <p>I get the following error</p>
  
  <blockquote>
    <p>[trim for output stream 0:0 @ 0000000002145720] Cannot select channel
    layout for the link between filters trim for output stream 0:0 and
    output stream 0:0.<br>
    [trim for output stream 0:0 @ 0000000002145720] 
    Unknown channel layouts not supported, try specifying a channel layout
    using 'aformat=channel_layouts=something'.</p>
  </blockquote>
  
  <p>Anyone have any ideas what I'm doing wrong and how to fix it?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-13T23:32:02.643Z
Comments.Text: Your 2nd command works for me on a movie with a 6-channel AC3 track.  BTW, you probably want to use `-c:a libfdk_aac`, not the default AAC encoder.  Is your ffmpeg version old?  Does `-ss` work on that input stream when you aren't using that filter?
Comments.UserDisplayName: Peter Cordes
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-21T08:13:18.367Z
Comments.Text: Thanks @PeterCordes! I had an older version of FFmpeg - it works in the latest version!
Comments.UserDisplayName: charisk
Tags: <ffmpeg>
Title: FFmpeg pan filter and clipping
UserDisplayName: charisk
ThreadText: # FFmpeg pan filter and clipping
  
  (Asked by: username_0 on 2015-07-09)
  
  I have a file that has one video stream and one audio stream with 8 channels. I want to create a new file that will only contain the first 2 channels of the audio stream (no video). I can do this using the [pan filter](https://ffmpeg.org/ffmpeg-filters.html#pan). I also want to clip the file. I can do this using the [-ss and -t options](https://www.ffmpeg.org/ffmpeg.html#toc-Main-options). However, when I try to do both together, I get an error.
  
  So, if I run:
  
  ```
  ffmpeg -i a.mov -filter_complex "[0:1]pan=2c|c0=c0|c1=c1[stereo]" -map "[stereo]" "a.audio.mov"
  
  ```
  
  It works fine - I get the audio file with the correct channels.
  
  But when I run:
  
  ```
  ffmpeg -i a.mov -filter_complex "[0:1]pan=2c|c0=c0|c1=c1[stereo]" -map "[stereo]" -ss 00:00:01 "a.audio.mov"
  
  ```
  
  I get the following error
  
  > [trim for output stream 0:0 @ 0000000002145720] Cannot select channel
  > layout for the link between filters trim for output stream 0:0 and
  > output stream 0:0.  
  > [trim for output stream 0:0 @ 0000000002145720]
  > Unknown channel layouts not supported, try specifying a channel layout
  > using 'aformat=channel\_layouts=something'.
  
  Anyone have any ideas what I'm doing wrong and how to fix it?
  
  **Tags:** ffmpeg
  
  > **Comments:**
  > **username_1**: Your 2nd command works for me on a movie with a 6-channel AC3 track.  BTW, you probably want to use `-c:a libfdk_aac`, not the default AAC encoder.  Is your ffmpeg version old?  Does `-ss` work on that input stream when you aren't using that filter?  
  > **username_0**: Thanks @username_1! I had an older version of FFmpeg - it works in the latest version!  
  
  ---
  
  ## 0 answers
  
  