Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#9869 closed defect (fixed)

AudioToolBox AAC problem with channels

Reported by: Atarikid Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords: audiotoolbox
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

When encoding to AAC with AudioToolBox aac_at you cannot set the channels.
For example a source with 5.1 channels, converts fine when not using the -ac option.

Here is a successful attempt log:

/Users/Atarikid/Desktop/ffmpeg -i /Users/Atarikid/Desktop/Royale.mp4 -c:a aac_at /Users/Atarikid/Movies/Rock.mp4
ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developers

built with Apple clang version 13.0.0 (clang-1300.0.29.30)
configuration: --prefix=/Volumes/tempdisk/sw --extra-cflags=-fno-stack-check --arch=arm64 --cc=/usr/bin/clang --enable-gpl --enable-libopenjpeg --enable-libopus --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libwebp --enable-libass --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libsnappy --enable-libaom --enable-libvidstab --enable-libzimg --enable-libsvtav1 --enable-version3 --pkg-config-flags=--static --disable-ffplay --enable-postproc --enable-nonfree --enable-neon --enable-runtime-cpudetect --disable-indev=qtkit --disable-indev=x11grab_xcb
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/Atarikid/Desktop/Royale.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.36.100

Duration: 00:02:34.55, start: 0.000000, bitrate: 1649 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709, progressive), 720x426 [SAR 64:45 DAR 512:213], 1260 kb/s, SAR 1775:1248 DAR 125:52, 24.99 fps, 25 tbr, 90k tbn (default)

Metadata:

handler_name : VideoHandler
vendor_id : [0][0][0][0]

Stream #0:1[0x2](eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 384 kb/s (default)

Metadata:

handler_name : SoundHandler
vendor_id : [0][0][0][0]

Side data:

audio service type: main

File '/Users/Atarikid/Movies/Rock.mp4' already exists. Overwrite? [y/N] y
Stream mapping:

Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (ac3 (native) -> aac (aac_at))

Press [q] to stop, ? for help
[aac_at @ 0x136005d90] Bitrate 128000 not allowed; changing to 160000
[libx264 @ 0x136011090] using SAR=1775/1248
[libx264 @ 0x136011090] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x136011090] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x136011090] 264 - core 164 r3075 66a5bc1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=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 chroma_qp_offset=-2 threads=13 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 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
Output #0, mp4, to '/Users/Atarikid/Movies/Rock.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.16.100

Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709, progressive), 720x426 [SAR 1775:1248 DAR 125:52], q=2-31, 25 fps, 12800 tbn (default)

Metadata:

handler_name : VideoHandler
vendor_id : [0][0][0][0]
encoder : Lavc59.18.100 libx264

Side data:

cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A

Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1(side), s16, 128 kb/s (default)

Metadata:

handler_name : SoundHandler
vendor_id : [0][0][0][0]
encoder : Lavc59.18.100 aac_at

Side data:

audio service type: main

frame= 1 fps=0.0 q=0.0 size= 0kB time=00:00:00.31 bitrate= 1.2kbits/sframe= 217 fps=0.0 q=28.0 size= 1024kB time=00:00:08.98 bitrate= 934.2kbits/frame= 430 fps=419 q=28.0 size= 2816kB time=00:00:17.49 bitrate=1318.8kbits/frame= 708 fps=464 q=28.0 size= 4096kB time=00:00:28.62 bitrate=1172.1kbits/frame= 1046 fps=516 q=28.0 sizeframe= 3863 fps=606 q=-1.0 Lsize= 18116kB time=00:02:34.49 bitrate= 960.6kbits/s speed=24.2x
video:14981kB audio:3020kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.635446%
[libx264 @ 0x136011090] frame I:43 Avg QP:19.35 size: 29964
[libx264 @ 0x136011090] frame P:1299 Avg QP:23.07 size: 6742
[libx264 @ 0x136011090] frame B:2521 Avg QP:26.48 size: 2100
[libx264 @ 0x136011090] consecutive B-frames: 8.0% 13.3% 5.2% 73.5%
[libx264 @ 0x136011090] mb I I16..4: 8.8% 77.5% 13.6%
[libx264 @ 0x136011090] mb P I16..4: 2.6% 12.3% 1.5% P16..4: 36.4% 14.6% 7.7% 0.0% 0.0% skip:24.8%
[libx264 @ 0x136011090] mb B I16..4: 0.3% 1.7% 0.1% B16..8: 34.5% 5.6% 1.2% direct: 2.1% skip:54.4% L0:41.6% L1:49.4% BI: 9.0%
[libx264 @ 0x136011090] 8x8 transform intra:75.8% inter:77.3%
[libx264 @ 0x136011090] coded y,uvDC,uvAC intra: 61.5% 65.5% 20.0% inter: 14.8% 15.4% 0.5%
[libx264 @ 0x136011090] i16 v,h,dc,p: 34% 16% 6% 44%
[libx264 @ 0x136011090] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 13% 18% 5% 7% 9% 6% 8% 6%
[libx264 @ 0x136011090] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 14% 14% 5% 9% 10% 7% 7% 5%
[libx264 @ 0x136011090] i8c dc,h,v,p: 53% 15% 27% 6%
[libx264 @ 0x136011090] Weighted P-Frames: Y:3.5% UV:1.8%
[libx264 @ 0x136011090] ref P L0: 65.4% 16.4% 13.3% 4.7% 0.1%
[libx264 @ 0x136011090] ref B L0: 90.4% 7.8% 1.7%
[libx264 @ 0x136011090] ref B L1: 97.2% 2.8%
[libx264 @ 0x136011090] kb/s:794.21

Now with -ac 6 (the source is already 5.1 but any -ac value will trigger the problem).

/Users/Atarikid/Desktop/ffmpeg -i /Users/Atarikid/Desktop/Royale.mp4 -c:a aac_at -ac 6 /Users/Atarikid/Movies/Rock.mp4
ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developers

built with Apple clang version 13.0.0 (clang-1300.0.29.30)
configuration: --prefix=/Volumes/tempdisk/sw --extra-cflags=-fno-stack-check --arch=arm64 --cc=/usr/bin/clang --enable-gpl --enable-libopenjpeg --enable-libopus --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libwebp --enable-libass --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libsnappy --enable-libaom --enable-libvidstab --enable-libzimg --enable-libsvtav1 --enable-version3 --pkg-config-flags=--static --disable-ffplay --enable-postproc --enable-nonfree --enable-neon --enable-runtime-cpudetect --disable-indev=qtkit --disable-indev=x11grab_xcb
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/Atarikid/Desktop/Royale.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.36.100

Duration: 00:02:34.55, start: 0.000000, bitrate: 1649 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709, progressive), 720x426 [SAR 64:45 DAR 512:213], 1260 kb/s, SAR 1775:1248 DAR 125:52, 24.99 fps, 25 tbr, 90k tbn (default)

Metadata:

handler_name : VideoHandler
vendor_id : [0][0][0][0]

Stream #0:1[0x2](eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 384 kb/s (default)

Metadata:

handler_name : SoundHandler
vendor_id : [0][0][0][0]

Side data:

audio service type: main

File '/Users/Atarikid/Movies/Rock.mp4' already exists. Overwrite? [y/N] y
Stream mapping:

Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (ac3 (native) -> aac (aac_at))

Press [q] to stop, ? for help
[aac_at @ 0x12f604bc0] Specified channel layout '5.1' is not supported
Error initializing output stream 0:1 -- Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

It returns "[aac_at @ 0x12f604bc0] Specified channel layout '5.1' is not supported'
But that's not correct.

Change History (2)

comment:1 by James, 2 years ago

Analyzed by developer: set
Component: undeterminedffmpeg
Reproduced by developer: set
Resolution: fixed
Status: newclosed

comment:2 by Carl Eugen Hoyos, 2 years ago

Keywords: audiotoolbox added
Note: See TracTickets for help on using tickets.