Opened 17 months ago

Last modified 17 months ago

#11480 open enhancement

Add support for Apple APAC spatial audio codec

Reported by: emcodem Owned by:
Priority: wish Component: undetermined
Version: git-master Keywords: apac
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Ever since the release of Iphone 16 we get lots of transcoding errors from these files because the apac track is being analyzed as valid audio track but when using -map 0:a and decoding the audio, ffmpeg command fails.

Example file (consider this file GPL Licensed): https://ffastrans.com/frm/forum/download/file.php?id=1785

Full, uncut ffmpeg command:

ffmpeg -i C:\in\IMG_0755.mov -map 0:a C:\out\VID_IMG_0755.mov
ffmpeg version git-2025-01-12-5a72266-ffmpeg-windows-build-helpers Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 10.2.0 (GCC)
  configuration: --pkg-config=pkg-config --pkg-config-flags=--static --extra-version=ffmpeg-windows-build-helpers --enable-version3 --disable-debug --disable-w32threads --arch=x86_64 --target-os=mingw32 --cross-prefix=/home/runner/work/ffmpeg-autobuild/ffmpeg-autobuild/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --enable-libcaca --enable-gray --enable-libtesseract --enable-fontconfig --enable-gmp --enable-libass --enable-libbluray --enable-libbs2b --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libvorbis --enable-libwebp --enable-libzimg --enable-libzvbi --enable-libmysofa --enable-libopenjpeg --enable-libopenh264 --enable-libvmaf --enable-libsrt --enable-libxml2 --enable-opengl --enable-libdav1d --enable-gnutls --enable-libsvtav1 --enable-libvpx --enable-libaom --enable-nvenc --enable-nvdec --extra-libs=-lz --extra-libs=-lpng --extra-libs=-lm --extra-libs=-lfreetype --extra-libs=-lshlwapi --extra-libs=-lmpg123 --extra-libs=-lpthread --extra-cflags=-DLIBTWOLAME_STATIC --extra-cflags=-DMODPLUG_STATIC --extra-cflags=-DCACA_STATIC --enable-amf --enable-libmfx --enable-libaribcaption --enable-gpl --enable-frei0r --enable-librubberband --enable-libvidstab --enable-libx264 --enable-libx265 --enable-avisynth --enable-libaribb24 --enable-libxvid --enable-libdavs2 --enable-libxavs2 --enable-libxavs --extra-cflags='-mtune=generic' --extra-cflags=-O3 --enable-static --disable-shared --prefix=/home/runner/work/ffmpeg-autobuild/ffmpeg-autobuild/ffmpeg-source --enable-nonfree --enable-libfdk-aac --enable-decklink
  libavutil      59. 55.100 / 59. 55.100
  libavcodec     61. 31.100 / 61. 31.100
  libavformat    61.  9.106 / 61.  9.106
  libavdevice    61.  4.100 / 61.  4.100
  libavfilter    10.  6.101 / 10.  6.101
  libswscale      8. 13.100 /  8. 13.100
  libswresample   5.  4.100 /  5.  4.100
  libpostproc    58.  4.100 / 58.  4.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000230704d40c0] Could not find codec parameters for stream 1 (Audio: none (apac / 0x63617061), 48000 Hz, 4 channels, 380 kb/s): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[aist#0:1/none @ 0000023070570a40] Guessed Channel Layout: 4.0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\in\IMG_0755.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    creation_time   : 2025-02-21T08:23:56.000000Z
    com.apple.quicktime.location.accuracy.horizontal: 52.734851
    com.apple.quicktime.full-frame-rate-playback-intent: 0
    com.apple.quicktime.location.ISO6709: +48.0770+016.3091+206.213/
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 16 Pro
    com.apple.quicktime.software: 18.1.1
    com.apple.quicktime.creationdate: 2025-02-21T09:16:10+0100
    com.apple.photos.originating.signature: Ab3Aztnrmyspxpqg/3IMG6C6GYGA
  Duration: 00:00:55.18, start: 0.000000, bitrate: 38645 kb/s
  Stream #0:0[0x1](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2025-02-21T08:23:56.000000Z
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: none (apac / 0x63617061), 48000 Hz, 4.0, 380 kb/s
    Metadata:
      creation_time   : 2025-02-21T08:23:56.000000Z
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 37895 kb/s, 119.95 fps, 120 tbr, 2400 tbn (default)
    Metadata:
      creation_time   : 2025-02-21T08:23:56.000000Z
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
      encoder         : H.264
  Stream #0:3[0x4](und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2025-02-21T08:23:56.000000Z
      handler_name    : Core Media Metadata
  Stream #0:4[0x5](und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2025-02-21T08:23:56.000000Z
      handler_name    : Core Media Metadata
  Stream #0:5[0x6](und): Data: none (mebx / 0x7862656D), 1 kb/s (default)
    Metadata:
      creation_time   : 2025-02-21T08:23:56.000000Z
      handler_name    : Core Media Metadata
  Stream #0:6[0x7](und): Data: none (mebx / 0x7862656D), 200 kb/s (default)
    Metadata:
      creation_time   : 2025-02-21T08:23:56.000000Z
      handler_name    : Core Media Metadata
  Stream #0:7[0x8](und): Data: none (mebx / 0x7862656D), 11 kb/s (default)
    Metadata:
      creation_time   : 2025-02-21T08:23:56.000000Z
      handler_name    : Core Media Metadata
  Stream #0:8[0x9](und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2025-02-21T08:23:56.000000Z
      handler_name    : Core Media Metadata
[aist#0:1/none @ 0000023070570a40] Decoding requested, but no decoder found for: none
Error opening output file C:\out\VID_IMG_0755.mov.
Error opening output files: Invalid argument

Attachments (1)

iphone16_apac.MOV (2.0 MB ) - added by emcodem 17 months ago.

Download all attachments as: .zip

Change History (2)

by emcodem, 17 months ago

Attachment: iphone16_apac.MOV added

comment:1 by James, 17 months ago

Keywords: audio removed
Priority: normalwish
Status: newopen
Summary: Support or ignore Iphone16 spatial Apple apac audioAdd support for Apple APAC spatial audio codec

With the -map 0:a option you're explicitly telling ffmpeg to select all audio streams. It's obviously going to fail there's no decoder for one of them.
If you don't specify a map, ffmpeg will select the aac track by default.

Note: See TracTickets for help on using tickets.