4

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. I also want to clip the file. I can do this using the -ss and -t 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?

  • 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? – Peter Cordes Jul 13 '15 at 23:32
  • 1
    Thanks @PeterCordes! I had an older version of FFmpeg - it works in the latest version! – charisk Jul 21 '15 at 8:13
3

This was bug in atrim filter, not supporting unknown channel layouts, it should be fixed in latest ffmpeg.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.