Answers.Body: <p>Your AAC encoder only supports 2 channels. Add <code>-ac 2</code>.</p>
  
  <p>But actually, you should upgrade your FFmpeg. It's very old, the VO AAC encoder is no longer available as the native encoder is better and supports 7.1 CH audio, so no downmixing required.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-27T19:33:16.923Z
Answers.Text: Thanks a ton! I still don't get why I never had to set any audio parameters before, but what works works, I guess. About the version, this is a XP machine (yes, I have complained about this to my employer a million times...) so I try to avoid updates lest they break something. Will look around for a more recent stable release, though. Thanks again!
Answers.UserDisplayName: Maldoror
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-27T19:51:42.260Z
Answers.Text: Check this thread for XP builds: https://ffmpeg.zeranoe.com/forum/viewtopic.php?f=13&t=3572&sid=7724c0e3b458fd1dce0a4ce17711c1ea
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-27T18:52:31.443Z
Answers.LastActivityDate: 2017-03-27T18:52:31.443Z
Answers.UserDisplayName: Gyan
Body: <p>Ok, this is probably a very stupid mistake on my part, but I am losing my head here. I have been using a simple command for transcoding MOV file for months now:</p>
  <pre><code>ffmpeg -i SOURCE.mov -c:v libx264 -profile:v baseline -pix_fmt yuv420 TRANSCODED.mp4
  </code></pre>
  <p>I never had a problem with that... until today. I am getting the aforementioned encoder error with this MOV (PCM24 LE, MPEG-2). Here is the log:</p>
  <pre><code>ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers   built with gcc 5.2.0 (GCC)   configuration: --enable-gpl
  --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib   libavutil      54. 31.100 / 54. 31.100   libavcodec     56. 60.100 /
  56. 60.100   libavformat    56. 40.101 / 56. 40.101   libavdevice    56.  4.100 / 56.  4.100   libavfilter     5. 40.101 /  5. 40.101   libswscale      3.  1.101 /  3.  1.101   libswresample   1.  2.101 / 
  1.  2.101   libpostproc    53.  3.100 / 53.  3.100 Guessed Channel Layout for  Input Stream #0.0 : 7.1 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'BL2.mov':   Metadata:
      major_brand     : qt  
      minor_version   : 0
      compatible_brands: qt  
      creation_time   : 2017-03-14 21:48:34
      encoder         : FFmbc 0.7
      timecode        : 00:13:29;19   Duration: 00:12:53.57, start: 0.000000, bitrate: 59235 kb/s
      Stream #0:0(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 8 channels, s32 (24 bit), 9216 kb/s (default)
      Metadata:
        creation_time   : 2017-03-14 21:48:34
        handler_name    : Apple Alias Data Handler
      Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
      Metadata:
        creation_time   : 2017-03-14 21:48:34
        handler_name    : Apple Alias Data Handler
        timecode        : 00:13:29;19
      Stream #0:2(eng): Video: mpeg2video (4:2:2) (xd5b / 0x62356478), yuv422p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 50002 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
      Metadata:
        creation_time   : 2017-03-14 22:56:29
        handler_name    : Apple Alias Data Handler
        timecode        : 00:13:29;19 [libx264 @ 0354dc20] using SAR=1/1 [libx264 @ 0354dc20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64 [libx264 @ 0354dc20] profile Constrained Baseline, level 4.0 [libx264 @ 0354dc20] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 [libvo_aacenc @ 03bb0200] Unable to set encoding parameters
  Output #0, mp4, to 'bl2.mp4':   Metadata:
      major_brand     : qt  
      minor_version   : 0
      compatible_brands: qt  
      timecode        : 00:13:29;19
      encoder         : FFmbc 0.7
      Stream #0:0(eng): Video: h264 (libx264), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
      Metadata:
        creation_time   : 2017-03-14 22:56:29
        handler_name    : Apple Alias Data Handler
        timecode        : 00:13:29;19
        encoder         : Lavc56.60.100 libx264
      Stream #0:1(eng): Audio: aac, 0 channels, 128 kb/s (default)
      Metadata:
        creation_time   : 2017-03-14 21:48:34
        handler_name    : Apple Alias Data Handler
        encoder         : Lavc56.60.100 libvo_aacenc
  Stream mapping:   Stream #0:2 -&gt; #0:0 (mpeg2video (native) -&gt; h264 (libx264))   Stream
  #0:0 -&gt; #0:1 (pcm_s24le (native) -&gt; aac (libvo_aacenc)) Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
  </code></pre>
  <p>This seems to tell me that it is an audio issue (even though I transcoded an identically encoded file just last friday...):</p>
  <blockquote>
  <p>[libvo_aacenc @ 03bb0200] Unable to set encoding parameters</p>
  </blockquote>
  <p>So I try to copy the audio codec (not sure if this works for MP4...) with &quot;-c:a copy&quot; and I get this:</p>
  <blockquote>
  <pre><code>Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 7.1 (24 bit), 9216 kb/s (default)
  Metadata:
    creation_time   : 2017-03-14 21:48:34
    handler_name    : Apple Alias Data Handler Stream mapping:   Stream #0:2 -&gt; #0:0 (mpeg2video (native) -&gt; h264 (libx264))   Stream
  </code></pre>
  <h1>0:0 -&gt; #0:1 (copy) Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument</h1>
  </blockquote>
  <p>What is going on here?</p>
  
Tags: <ffmpeg><audio><transcoding>
Title: ffmpeg "Error while opening encoder for output stream #0:1"
UserDisplayName: Maldoror
ThreadText: # ffmpeg "Error while opening encoder for output stream #0:1"
  
  (Asked by: username_0 on 2017-03-27)
  
  Ok, this is probably a very stupid mistake on my part, but I am losing my head here. I have been using a simple command for transcoding MOV file for months now:
  
  ```
  ffmpeg -i SOURCE.mov -c:v libx264 -profile:v baseline -pix_fmt yuv420 TRANSCODED.mp4
  
  ```
  
  I never had a problem with that... until today. I am getting the aforementioned encoder error with this MOV (PCM24 LE, MPEG-2). Here is the log:
  
  ```
  ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers   built with gcc 5.2.0 (GCC)   configuration: --enable-gpl
  --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib   libavutil      54. 31.100 / 54. 31.100   libavcodec     56. 60.100 /
  56. 60.100   libavformat    56. 40.101 / 56. 40.101   libavdevice    56.  4.100 / 56.  4.100   libavfilter     5. 40.101 /  5. 40.101   libswscale      3.  1.101 /  3.  1.101   libswresample   1.  2.101 / 
  1.  2.101   libpostproc    53.  3.100 / 53.  3.100 Guessed Channel Layout for  Input Stream #0.0 : 7.1 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'BL2.mov':   Metadata:
      major_brand     : qt  
      minor_version   : 0
      compatible_brands: qt  
      creation_time   : 2017-03-14 21:48:34
      encoder         : FFmbc 0.7
      timecode        : 00:13:29;19   Duration: 00:12:53.57, start: 0.000000, bitrate: 59235 kb/s
      Stream #0:0(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 8 channels, s32 (24 bit), 9216 kb/s (default)
      Metadata:
        creation_time   : 2017-03-14 21:48:34
        handler_name    : Apple Alias Data Handler
      Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
      Metadata:
        creation_time   : 2017-03-14 21:48:34
        handler_name    : Apple Alias Data Handler
        timecode        : 00:13:29;19
      Stream #0:2(eng): Video: mpeg2video (4:2:2) (xd5b / 0x62356478), yuv422p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 50002 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
      Metadata:
        creation_time   : 2017-03-14 22:56:29
        handler_name    : Apple Alias Data Handler
        timecode        : 00:13:29;19 [libx264 @ 0354dc20] using SAR=1/1 [libx264 @ 0354dc20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64 [libx264 @ 0354dc20] profile Constrained Baseline, level 4.0 [libx264 @ 0354dc20] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 [libvo_aacenc @ 03bb0200] Unable to set encoding parameters
  Output #0, mp4, to 'bl2.mp4':   Metadata:
      major_brand     : qt  
      minor_version   : 0
      compatible_brands: qt  
      timecode        : 00:13:29;19
      encoder         : FFmbc 0.7
      Stream #0:0(eng): Video: h264 (libx264), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
      Metadata:
        creation_time   : 2017-03-14 22:56:29
        handler_name    : Apple Alias Data Handler
        timecode        : 00:13:29;19
        encoder         : Lavc56.60.100 libx264
      Stream #0:1(eng): Audio: aac, 0 channels, 128 kb/s (default)
      Metadata:
        creation_time   : 2017-03-14 21:48:34
        handler_name    : Apple Alias Data Handler
        encoder         : Lavc56.60.100 libvo_aacenc
  Stream mapping:   Stream #0:2 -> #0:0 (mpeg2video (native) -> h264 (libx264))   Stream
  #0:0 -> #0:1 (pcm_s24le (native) -> aac (libvo_aacenc)) Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
  
  ```
  
  This seems to tell me that it is an audio issue (even though I transcoded an identically encoded file just last friday...):
  
  > [libvo\_aacenc @ 03bb0200] Unable to set encoding parameters
  
  So I try to copy the audio codec (not sure if this works for MP4...) with "-c:a copy" and I get this:
  
  > ```
  > Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 7.1 (24 bit), 9216 kb/s (default)
  > Metadata:
  >   creation_time   : 2017-03-14 21:48:34
  >   handler_name    : Apple Alias Data Handler Stream mapping:   Stream #0:2 -> #0:0 (mpeg2video (native) -> h264 (libx264))   Stream
  >
  > ```
  >
  > # 0:0 -> #0:1 (copy) Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
  
  What is going on here?
  
  **Tags:** ffmpeg, audio, transcoding
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-03-27. Score: 0 | Accepted answer
  
  Your AAC encoder only supports 2 channels. Add `-ac 2`.
  
  But actually, you should upgrade your FFmpeg. It's very old, the VO AAC encoder is no longer available as the native encoder is better and supports 7.1 CH audio, so no downmixing required.
  
  > **Comments:**
  > **username_0**: Thanks a ton! I still don't get why I never had to set any audio parameters before, but what works works, I guess. About the version, this is a XP machine (yes, I have complained about this to my employer a million times...) so I try to avoid updates lest they break something. Will look around for a more recent stable release, though. Thanks again!  
  > **username_1**: Check this thread for XP builds: https://ffmpeg.zeranoe.com/forum/viewtopic.php?f=13&t=3572&sid=7724c0e3b458fd1dce0a4ce17711c1ea  
  
  ---
  
  