Answers.Body: <p><code>-profile:a aac_he</code> applies to <em>all</em> output audio streams. Apply it to only the intended stream; <code>-profile:a:1 aac_he</code>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-26T04:03:17.887Z
Answers.LastActivityDate: 2024-01-26T04:03:17.887Z
Answers.UserDisplayName: Gyan
Body: <p>I am attempting to add secondary audio with FFmpeg to copy my primary audio over and encode it with libfdk_aac using profile aac_he. When I do, I am getting the following errors:</p>
  <p>[NULL @ 000001f4d7830b80] [Eval @ 0000003fb93fdf50] Undefined constant or missing '(' in 'aac_he'
  [NULL @ 000001f4d7830b80] Unable to parse option value &quot;aac_he&quot;
  [NULL @ 000001f4d7830b80] Error setting option profile to value aac_he.
  Error setting up codec context options.
  Error initializing output stream 0:1 --*
  Here is the command I am trying to use:</p>
  <p>ffmpeg -y -fflags -genpts -i -map 0:v -c:v copy -map 0:a -c:a:0 copy -map 0:a -c:a:1 libfdk_aac -profile:a aac_he e:\nf.ts
  I would expect it to copy the Primary audio to Audio 1 (AC3), and then re-encode the audio from Audio 1 to to Audio 2 (aac_he).</p>
  <p>If I only use aac native audio, instead of aac_he, it works fine using this command:</p>
  <p>ffmpeg -y -fflags -genpts -i %%f -map 0:v -c:v copy -map 0:a -c:a:0 copy -map 0:a -c:a:1 aac e:\nf.ts
  From this, I get Audio 1 (AC3) and Audio 2(aac).</p>
  <p>or it works if I just re-encode the primary audio like using this command:</p>
  <p>ffmpeg -y -fflags -genpts -i %%f -map 0:v -c:v copy -map 0:a -c:a:0 libfdk_aac -profile:a aac_he e:\nf.ts
  From this, I get Audio 1(aac_he)</p>
  <p>Is there something about using the aac_he in the secondary audio position that ffmpeg has issues with?</p>
  
Tags: <ffmpeg>
Title: Getting an error when attempting to use FFmpeg to copy primary AC3 audio to aac_he secondary audio
UserDisplayName: Tom Dimmer
ThreadText: # Getting an error when attempting to use FFmpeg to copy primary AC3 audio to aac_he secondary audio
  
  (Asked by: username_0 on 2024-01-25)
  
  I am attempting to add secondary audio with FFmpeg to copy my primary audio over and encode it with libfdk\_aac using profile aac\_he. When I do, I am getting the following errors:
  
  [NULL @ 000001f4d7830b80] [Eval @ 0000003fb93fdf50] Undefined constant or missing '(' in 'aac\_he'
  [NULL @ 000001f4d7830b80] Unable to parse option value "aac\_he"
  [NULL @ 000001f4d7830b80] Error setting option profile to value aac\_he.
  Error setting up codec context options.
  Error initializing output stream 0:1 --\*
  Here is the command I am trying to use:
  
  ffmpeg -y -fflags -genpts -i -map 0:v -c:v copy -map 0:a -c:a:0 copy -map 0:a -c:a:1 libfdk\_aac -profile:a aac\_he e:\nf.ts
  I would expect it to copy the Primary audio to Audio 1 (AC3), and then re-encode the audio from Audio 1 to to Audio 2 (aac\_he).
  
  If I only use aac native audio, instead of aac\_he, it works fine using this command:
  
  ffmpeg -y -fflags -genpts -i %%f -map 0:v -c:v copy -map 0:a -c:a:0 copy -map 0:a -c:a:1 aac e:\nf.ts
  From this, I get Audio 1 (AC3) and Audio 2(aac).
  
  or it works if I just re-encode the primary audio like using this command:
  
  ffmpeg -y -fflags -genpts -i %%f -map 0:v -c:v copy -map 0:a -c:a:0 libfdk\_aac -profile:a aac\_he e:\nf.ts
  From this, I get Audio 1(aac\_he)
  
  Is there something about using the aac\_he in the secondary audio position that ffmpeg has issues with?
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-01-26. Score: 0 | Accepted answer
  
  `-profile:a aac_he` applies to *all* output audio streams. Apply it to only the intended stream; `-profile:a:1 aac_he`.
  
  
  ---
  
  