Opened 2 years ago

Closed 19 months ago

Last modified 7 months ago

#5369 closed defect (fixed)

new audiotoolbox encoder does not support AAC encoding with more than 2 channels

Reported by: julian Owned by: 11rcombs
Priority: normal Component: undetermined
Version: git-master Keywords: audiotoolbox osx
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by cehoyos)

this is new audiotoolbox encoders checked into git head yesterday

ffmpeg -i test.mkv  -stats -map 0:0 -map 0:1 -map 0:2 -scodec mov_text -vcodec copy -acodec aac  -y test.mp4

ffmpeg version N-79115-g65cff81 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --disable-encoders --disable-muxers --enable-muxer=ac3 --enable-muxer=mp4 --enable-encoder=aac_at --enable-encoder=ac3 --enable-encoder=ac3_fixed --enable-encoder=movtext --enable-muxer=mp3 --disable-indev=qtkit
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 30.100 / 57. 30.100
  libavformat    57. 29.100 / 57. 29.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 39.102 /  6. 39.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
[h264 @ 0x7f953a810c00] Increasing reorder buffer to 1
Input #0, matroska,webm, from '/Users/julian/Desktop/test.mkv':
  Metadata:
    ENCODER         : Lavf55.19.104
  Duration: 00:00:10.05, start: 0.000000, bitrate: 4672 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709), 1280x718 [SAR 1:1 DAR 640:359], 23.98 fps, 23.98 tbr, 1k tbn, 2k tbc (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
    Stream #0:2(eng): Subtitle: subrip
    Metadata:
      title           : CC
      LANGUAGE        : eng
[aac_at @ 0x7f953b827c00] AudioToolbox cookie error: 560226676
Output #0, mp4, to '/Users/julian/Desktop/ar.mp4':
  Metadata:
    ENCODER         : Lavf55.19.104
    Stream #0:0(eng): Video: h264, yuv420p, 1280x718 [SAR 1:1 DAR 640:359], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: aac, 0 channels, 128 kb/s (default)
    Metadata:
      LANGUAGE        : eng
      encoder         : Lavc57.30.100 aac_at
    Stream #0:2(eng): Subtitle: mov_text, 128 kb/s
    Metadata:
      title           : CC
      LANGUAGE        : eng
      encoder         : Lavc57.30.100 mov_text
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (aac_at))
  Stream #0:2 -> #0:2 (subrip (srt) -> mov_text (native))
Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height

Attachments (1)

test.mkv (963.7 KB) - added by julian 2 years ago.

Download all attachments as: .zip

Change History (14)

Changed 2 years ago by julian

comment:1 Changed 2 years ago by julian

there should probably also be fallback to another AAC encoder if available instead of an error

comment:2 Changed 2 years ago by cehoyos

  • Description modified (diff)
  • Keywords audiotoolbox added

comment:3 Changed 2 years ago by cehoyos

  • Keywords osx added

comment:4 follow-up: Changed 2 years ago by julian

  • Owner set to 11rcombs
  • Status changed from new to open

even more weird is this - if you convert to two channels it works fine:

ffmpeg -i test.mkv -map 0:0 -map 0:1 -vcodec copy -c:a:0 aac -ac:0 2 -b:a:0 128k test.mp4

but if additionally include an AC3 surround copy of the very same audiotrack it fails with the audiotoolbox code complaining:

ffmpeg -i test.mkv -map 0:0 -map 0:1 -map 0:1 -vcodec copy -c:a:0 aac -ac:0 2 -b:a:0 128k -c:a:1 ac3 -ac:1 6 -b:a:1 448k test.mp4

full output tested with GIT HEAD from a few seconds ago:

ffmpeg -i test.mkv -map 0:0 -map 0:1 -map 0:1 -vcodec copy -c:a:0 aac -ac:0 2 -b:a:0 128k -c:a:1 ac3 -ac:1 6 -b:a:1 448k test.mp4
ffmpeg version N-79651-ge1c2048 Copyright (c) 2000-2016 the FFmpeg developers

built with Apple LLVM version 7.3.0 (clang-703.0.29)
configuration: --disable-encoders --disable-muxers --enable-muxer=ac3 --enable-muxer=mp4 --enable-encoder=aac_at --enable-encoder=ac3 --enable-encoder=ac3_fixed --enable-encoder=movtext --enable-muxer=mp3 --disable-indev=qtkit --disable-securetransport --disable-network --disable-swscale --disable-postproc
libavutil 55. 22.101 / 55. 22.101
libavcodec 57. 38.100 / 57. 38.100
libavformat 57. 34.103 / 57. 34.103
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 44.100 / 6. 44.100
libswresample 2. 0.101 / 2. 0.101

[h264 @ 0x7fb0d3811200] Increasing reorder buffer to 1
Input #0, matroska,webm, from 'test.mkv':

Metadata:

ENCODER : Lavf55.19.104

Duration: 00:00:02.08, start: 0.016000, bitrate: 3791 kb/s

Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709), 1280x718 [SAR 1:1 DAR 640:359], 23.98 fps, 23.98 tbr, 1k tbn (default)
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default)
Stream #0:2(eng): Subtitle: subrip
Metadata:

title : CC
LANGUAGE : eng

File 'test.mp4' already exists. Overwrite ? [y/N] y
[aac_at @ 0x7fb0d401a400] Specified channel layout '5.1' is not supported
Output #0, mp4, to 'test.mp4':

Metadata:

ENCODER : Lavf55.19.104
Stream #0:0(eng): Unknown: none, SAR 1:1 DAR 0:0 (default)
Stream #0:1(eng): Unknown: none (default)
Metadata:

LANGUAGE : eng
encoder : Lavc57.38.100 aac_at

Stream #0:2(eng): Unknown: none (default)
Metadata:

LANGUAGE : eng
encoder : Lavc57.38.100 ac3

Stream mapping:

Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (ac3 (native) -> aac (aac_at))
Stream #0:1 -> #0:2 (ac3 (native) -> ac3 (native))

Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height

but the AC3 surround encoding shouldn't change anything in the audiotoolbox track! its still stereo and should still convert!

comment:5 in reply to: ↑ 4 Changed 2 years ago by cehoyos

Replying to julian:

but if additionally include an AC3 surround copy of the very same audiotrack it fails with the audiotoolbox code complaining:

ffmpeg -i test.mkv -map 0:0 -map 0:1 -map 0:1 -vcodec copy -c:a:0 aac -ac:0 2 -b:a:0 128k -c:a:1 ac3 -ac:1 6 -b:a:1 448k test.mp4

The syntax of -ac is unexpected, see ticket #4823.

comment:6 Changed 2 years ago by julian

ok thanks

original bug still stands and is especially weird since the commit message to "c820e600eac44ae722760b69ae920f14a79ec3eb" states that > 2 channel AAC encoding should work. i can only reproduce failures.

comment:7 Changed 2 years ago by cehoyos

Is there any indication that this can be fixed inside FFmpeg?

comment:8 Changed 2 years ago by gjdfgh

It could easily depend on your OSX version.

comment:9 Changed 19 months ago by richardpl

Looking at source code 5.1 is not supported, but 5.1(side) is.

comment:10 Changed 19 months ago by julian

can't reproduce the issue anymore with 3.1.3

comment:11 Changed 19 months ago by richardpl

  • Resolution set to fixed
  • Status changed from open to closed

Closing. Thanks for testing.

comment:12 Changed 7 months ago by julian

where in the code do you see that only 5.1(side) but not 5.1 is supported?
which other surround formats are missing too? how would i go about adding support for them?

comment:13 Changed 7 months ago by julian

where in the code do you see that only 5.1(side) but not 5.1 is supported?
which other surround formats are missing too? how would i go about adding support for them?

Note: See TracTickets for help on using tickets.