<p>You're using an ffmpeg with a 2-year-old version of <code>libx264</code>.  It's been mostly feature-complete for a while now, but there are still small improvements and fixes happening.</p>

<p>As Mulvya says, get one built with <code>libfdk_aac</code>, since you should update your ffmpeg for libx264 anyway.  Your current ffmpeg is trying to use the VisualOn aac encoder.  That's a <a href="https://trac.ffmpeg.org/wiki/Encode/AAC" rel="nofollow">terrible choice</a>.</p>

<p>Check the video encoding guide on ffmpeg's Trac wiki, too.  You should probably use <code>-preset slow</code> at least, to get more quality per bitrate. <code>-crf 23</code> is the default target-quality, which might be more or less than you want.</p>

CC BY-SA 3.0
2015-07-19T18:00:23.523Z
2015-07-19T18:00:23.523Z
Peter Cordes
<p>I am using following command to encode my video to h264 and aac audio codec : </p>

<pre><code>ffmpeg -i sample.mp4 -codec:v libx264 -profile:v high -level:v 4.0 -codec:a libvo_aacenc -b:a 128k output_file.mp4
</code></pre>

<p>Following is a trace of the error i am getting at the console.</p>

<pre><code>Input #0, mpegts, from 'sample.mp4':
  Duration: 00:00:58.08, start: 1.000033, bitrate: 17290 kb/s
  Program 1
    Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p, 1920x1
080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fl
tp, 448 kb/s
    Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
[libx264 @ 003dc660] using SAR=1/1
[libx264 @ 003dc660] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 003dc660] profile High, level 4.0
[libx264 @ 003dc660] 264 - core 130 r2274 c832fe9 - H.264/MPEG-4 AVC codec - Cop
yright 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 de
block=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1
me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chr
oma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1
 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=
1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scen
ecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmi
n=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libvo_aacenc @ 03c3c640] Unable to set encoding parameters
Output #0, mp4, to 'output_file.mp4':
    Stream #0:0: Video: h264, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 90
k tbn, 29.97 tbc
    Stream #0:1: Audio: aac, 48000 Hz, 5.1(side), s16, 128 kb/s
Stream mapping:
  Stream #0:0 -&gt; #0:0 (h264 -&gt; libx264)
  Stream #0:1 -&gt; #0:1 (ac3 -&gt; 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>I am really not able to find what possibly could be wrong. I dont want to copy audio codec , i wish to encode it from <strong>ac3</strong> to <strong>aac</strong></p>

<p>Also any suggestion to make it <strong>lossless</strong></p>

CC BY-SA 3.0
2015-07-15T11:53:01.203Z
Try adding -a:c 2 after -b:a 128k
Gyan
CC BY-SA 3.0
2015-07-16T04:49:17.707Z
Thanks !! that kinda worked for me... :) But next step now for me is to make it less lossy.
akki_2891
CC BY-SA 3.0
2015-07-16T05:28:03.947Z
Your source audio is 448kbps in 6 channels i.e. ~75kbps per channel, and your target codec is AAC (a lossy codec), so it won't be lossless. Most you can do is increase the target bitrate to something like 192k or higher from 128k. You'll, of course, lose the channel separation from 6 to 2.
Gyan
CC BY-SA 3.0
2015-07-16T06:27:07.667Z
Yeah i got to know that libvo_aacenc supports two channels only, so i thought to give a try for 'libfdk_aac' . But its says **Unknown Encoder 'libfdk_aac'**
I am quite novice to ffmpeg world :) Your help is much appreciated. Even i tried other aac encoders like aac and libfaac, but getting the errors
akki_2891
CC BY-SA 3.0
2015-07-16T06:59:52.103Z
ffmpeg has to be compiled with fdk. Your build apparently isn't. Use the native encoder with a higher bitrate, so "-strict experimental -c:a aac -b:a 384k" in place of "-codec:a libvo_aacenc -b:a 128k" in your original command.
Gyan
<ffmpeg>
FFmpeg : Error occurred while encoding audio stream from ac3 to aac
akki_2891
# FFmpeg : Error occurred while encoding audio stream from ac3 to aac

(Asked by: username_0 on 2015-07-15)

I am using following command to encode my video to h264 and aac audio codec : 
ffmpeg -i sample.mp4 -codec:v libx264 -profile:v high -level:v 4.0 -codec:a libvo_aacenc -b:a 128k output_file.mp4

Following is a trace of the error i am getting at the console.
Input #0, mpegts, from 'sample.mp4':
  Duration: 00:00:58.08, start: 1.000033, bitrate: 17290 kb/s
  Program 1
    Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p, 1920x1
080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fl
tp, 448 kb/s
    Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090)
[libx264 @ 003dc660] using SAR=1/1
[libx264 @ 003dc660] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 003dc660] profile High, level 4.0
[libx264 @ 003dc660] 264 - core 130 r2274 c832fe9 - H.264/MPEG-4 AVC codec - Cop
yright 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 de
block=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1
me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chr
oma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1
 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=
1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scen
ecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmi
n=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libvo_aacenc @ 03c3c640] Unable to set encoding parameters
Output #0, mp4, to 'output_file.mp4':
    Stream #0:0: Video: h264, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 90
k tbn, 29.97 tbc
    Stream #0:1: Audio: aac, 48000 Hz, 5.1(side), s16, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (ac3 -> libvo_aacenc)
Error while opening encoder for output stream #0:1 - maybe incorrect parameters
such as bit_rate, rate, width or height

I am really not able to find what possibly could be wrong. I dont want to copy audio codec , i wish to encode it from ac3 to aac
Also any suggestion to make it lossless

**Tags:** ffmpeg

> **Comments:**
> **username_1**: Try adding -a:c 2 after -b:a 128k  
> **username_0**: Thanks !! that kinda worked for me... :) But next step now for me is to make it less lossy.  
> **username_1**: Your source audio is 448kbps in 6 channels i.e. ~75kbps per channel, and your target codec is AAC (a lossy codec), so it won't be lossless. Most you can do is increase the target bitrate to something like 192k or higher from 128k. You'll, of course, lose the channel separation from 6 to 2.  
> **username_0**: Yeah i got to know that libvo_aacenc supports two channels only, so i thought to give a try for 'libfdk_aac' . But its says **Unknown Encoder 'libfdk_aac'** I am quite novice to ffmpeg world :) Your help is much appreciated. Even i tried other aac encoders like aac and libfaac, but getting the errors  
> **username_1**: ffmpeg has to be compiled with fdk. Your build apparently isn't. Use the native encoder with a higher bitrate, so "-strict experimental -c:a aac -b:a 384k" in place of "-codec:a libvo_aacenc -b:a 128k" in your original command.  

---

## 1 answers

### Answer by username_2 on 2015-07-19. Score: 1

You're using an ffmpeg with a 2-year-old version of `libx264`. It's been mostly feature-complete for a while now, but there are still small improvements and fixes happening.

As Mulvya says, get one built with `libfdk_aac`, since you should update your ffmpeg for libx264 anyway. Your current ffmpeg is trying to use the VisualOn aac encoder. That's a [terrible choice](https://trac.ffmpeg.org/wiki/Encode/AAC).

Check the video encoding guide on ffmpeg's Trac wiki, too. You should probably use `-preset slow` at least, to get more quality per bitrate. `-crf 23` is the default target-quality, which might be more or less than you want.


---

