Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

#11625 closed defect (invalid)

FFmpeg is unable to output .iamf files

Reported by: gamer191 Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: iamf
Cc: gamer191 Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: Changing the output file extension seems to fix the issue (but seems to result in the iamf data being deleted)

How to reproduce: Attempt to download any .iamf file and output it as a .iamf file. Note that -map 0 must be used because ffmpeg seems to treat each iamf audio channel as a separate stream (I'm not sure whether that's intended behaviour, but that's out of scope for this bug report)

% ffmpeg -i https://github.com/AOMediaCodec/iamf-tools/raw/refs/heads/main/gh_pages/web_demo/data/Animated_demo_3OA.iamf -map 0 Animated_demo_3OA.iamf
ffmpeg version N-119822-g3be9b3f156-20250604 Copyright (c) 2000-2025 the FFmpeg developers
  built with gcc 15.1.0 (crosstool-NG 1.27.0.42_35c1e72)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-zlib --enable-libfribidi --enable-gmp --enable-libxml2 --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libfreetype --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-libzmq --enable-lv2 --enable-libvpl --enable-openal --enable-liboapv --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libvvenc --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs=-lgomp --extra-ldflags=-pthread --extra-ldexeflags= --cc=x86_64-w64-mingw32-gcc --cxx=x86_64-w64-mingw32-g++ --ar=x86_64-w64-mingw32-gcc-ar --ranlib=x86_64-w64-mingw32-gcc-ranlib --nm=x86_64-w64-mingw32-gcc-nm --extra-version=20250604
  libavutil      60.  3.100 / 60.  3.100
  libavcodec     62.  3.101 / 62.  3.101
  libavformat    62.  0.102 / 62.  0.102
  libavdevice    62.  0.100 / 62.  0.100
  libavfilter    11.  0.100 / 11.  0.100
  libswscale      9.  0.100 /  9.  0.100
  libswresample   6.  0.100 /  6.  0.100
Input #0, iamf, from 'https://github.com/AOMediaCodec/iamf-tools/raw/refs/heads/main/gh_pages/web_demo/data/Animated_demo_3OA.iamf':
  Duration: N/A, bitrate: N/A
  Stream group #0:0[0x12c]: IAMF Audio Element:
    Layer 0: ambisonic 3
  Stream group #0:1[0x2a]: IAMF Mix Presentation:
    Submix 0:
      IAMF Audio Element #0:0[0x12c]
      Layout #0: stereo
      Layout #1: binaural
File 'Animated_demo_3OA.iamf' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (opus (native) -> opus (libopus))
  Stream #0:1 -> #0:1 (opus (native) -> opus (libopus))
  Stream #0:2 -> #0:2 (opus (native) -> opus (libopus))
  Stream #0:3 -> #0:3 (opus (native) -> opus (libopus))
  Stream #0:4 -> #0:4 (opus (native) -> opus (libopus))
  Stream #0:5 -> #0:5 (opus (native) -> opus (libopus))
  Stream #0:6 -> #0:6 (opus (native) -> opus (libopus))
  Stream #0:7 -> #0:7 (opus (native) -> opus (libopus))
  Stream #0:8 -> #0:8 (opus (native) -> opus (libopus))
  Stream #0:9 -> #0:9 (opus (native) -> opus (libopus))
  Stream #0:10 -> #0:10 (opus (native) -> opus (libopus))
  Stream #0:11 -> #0:11 (opus (native) -> opus (libopus))
  Stream #0:12 -> #0:12 (opus (native) -> opus (libopus))
  Stream #0:13 -> #0:13 (opus (native) -> opus (libopus))
  Stream #0:14 -> #0:14 (opus (native) -> opus (libopus))
  Stream #0:15 -> #0:15 (opus (native) -> opus (libopus))
Press [q] to stop, [?] for help
[libopus @ 000001ee77eff880] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77e1d900] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77e1b800] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee75d1db80] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77e1e080] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77eff100] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77e1bf40] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77e1ca40] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77f00b00] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77cc4400] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77e1e440] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77efed80] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77efd000] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77cc6180] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77cc47c0] No bit rate set. Defaulting to 64000 bps.
[libopus @ 000001ee77cc3180] No bit rate set. Defaulting to 64000 bps.
[iamf @ 000001ee75d3c3c0] Duplicated stream id 0
[out#0/iamf @ 000001ee75ce3f00] Could not write header (incorrect codec parameters ?): Invalid argument
[af#0:12 @ 000001ee77e5e2c0] Error sending frames to consumers: Invalid argument
[af#0:12 @ 000001ee77e5e2c0] Task finished with error code: -22 (Invalid argument)
[af#0:12 @ 000001ee77e5e2c0] Terminating thread with return code -22 (Invalid argument)
[out#0/iamf @ 000001ee75ce3f00] Nothing was written into output file, because at least one of its streams received no packets.
size=       0KiB time=N/A bitrate=N/A speed=N/A elapsed=0:00:00.07
Conversion failed!

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

ffmpeg-20250605-014107.log (145.0 KB ) - added by gamer191 14 months ago.

Download all attachments as: .zip

Change History (3)

by gamer191, 14 months ago

Attachment: ffmpeg-20250605-014107.log added

comment:1 by James, 14 months ago

Resolution: invalid
Status: newclosed

The iamf format is very complex, where individual streams are grouped into iamf elements, and it needs the user to specify information about what's being muxed. Check https://ffmpeg.org/ffmpeg.html for the stream_group section.

For a simple copy, it gives the following example:

To copy the two stream groups (Audio Element and Mix Presentation) from an input IAMF file with four streams into an mp4 output

ffmpeg -i input.iamf -c:a copy -stream_group map=0=0:st=0:st=1:st=2:st=3 -stream_group map=0=1:stg=0
-streamid 0:0 -streamid 1:1 -streamid 2:2 -streamid 3:3 output.mp4

In your file there are 16 streams, one per ambisonic channel, so it would look like the above but with the missing streams included.

comment:2 by gamer191, 14 months ago

Thanks @James

EDIT: I opened a feature request at https://trac.ffmpeg.org/ticket/11627 requesting a way to copy the stream_groups from the input file

Last edited 14 months ago by gamer191 (previous) (diff)
Note: See TracTickets for help on using tickets.