1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00
Go to file
James Almer cd2461e627 avformat/iamf: fix setting channel layout for Scalable layers
The way streams are coded in an IAMF struct follows a scalable model where the
channel layouts for each layer may not match the channel order our API can
represent in a Native order layout.

For example, an audio element may have six coded streams in the form of two
stereo streams, followed by two mono streams, and then by another two stereo
streams, for a total of 10 channels, and define for them four scalable layers
with loudspeaker_layout values "Stereo", "5.1ch", "5.1.2ch", and "5.1.4ch".
The first layer references the first stream, and each following layer will
reference all previous streams plus extra ones.
In this case, the "5.1ch" layer will reference four streams (the first two
stereo and the two mono) to encompass six channels, which does not match out
native layout 5.1(side) given that FC and LFE come after FL+FR but before
SL+SR, and here, they are at the end.

For this reason, we need to build Custom order layouts that properly represent
what we're exporting.

----
Before:

  Stream group #0:0[0x12c]: IAMF Audio Element:
    Layer 0: stereo
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
    Layer 1: 5.1(side)
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
    Layer 2: 5.1.2
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:4[0x4]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
    Layer 3: 5.1.4
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:4[0x4]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:5[0x5]: Audio: opus, 48000 Hz, stereo, fltp (dependent)

----
AFter:

  Stream group #0:0[0x12c]: IAMF Audio Element:
    Layer 0: stereo
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
    Layer 1: 6 channels (FL+FR+SL+SR+FC+LFE)
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
    Layer 2: 8 channels (FL+FR+SL+SR+FC+LFE+TFL+TFR)
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:4[0x4]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
    Layer 3: 10 channels (FL+FR+SL+SR+FC+LFE+TFL+TFR+TBL+TBR)
      Stream #0:0[0x0]: Audio: opus, 48000 Hz, stereo, fltp (default)
      Stream #0:1[0x1]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:2[0x2]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:3[0x3]: Audio: opus, 48000 Hz, mono, fltp (dependent)
      Stream #0:4[0x4]: Audio: opus, 48000 Hz, stereo, fltp (dependent)
      Stream #0:5[0x5]: Audio: opus, 48000 Hz, stereo, fltp (dependent)

Signed-off-by: James Almer <jamrial@gmail.com>
2025-06-24 14:41:43 -03:00
2025-06-23 17:19:18 +10:00
2025-06-15 21:00:38 +05:30
2024-07-15 01:59:37 +02:00
2025-06-23 17:16:42 +10:00
2023-03-01 21:59:10 +01:00
2025-06-23 14:48:40 +02:00
2025-05-15 12:17:04 +02:00
2025-05-07 15:35:47 +02:00
2025-05-26 20:33:10 +02:00

FFmpeg README

FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.

Libraries

  • libavcodec provides implementation of a wider range of codecs.
  • libavformat implements streaming protocols, container formats and basic I/O access.
  • libavutil includes hashers, decompressors and miscellaneous utility functions.
  • libavfilter provides means to alter decoded audio and video through a directed graph of connected filters.
  • libavdevice provides an abstraction to access capture and playback devices.
  • libswresample implements audio mixing and resampling routines.
  • libswscale implements color conversion and scaling routines.

Tools

  • ffmpeg is a command line toolbox to manipulate, convert and stream multimedia content.
  • ffplay is a minimalistic multimedia player.
  • ffprobe is a simple analysis tool to inspect multimedia content.
  • Additional small tools such as aviocat, ismindex and qt-faststart.

Documentation

The offline documentation is available in the doc/ directory.

The online documentation is available in the main website and in the wiki.

Examples

Coding examples are available in the doc/examples directory.

License

FFmpeg codebase is mainly LGPL-licensed with optional components licensed under GPL. Please refer to the LICENSE file for detailed information.

Contributing

Patches should be submitted to the ffmpeg-devel mailing list using git format-patch or git send-email. Github pull requests should be avoided because they are not part of our review process and will be ignored.

Languages
C 90.1%
Assembly 7.9%
Makefile 1.3%
C++ 0.2%
Objective-C 0.2%
Other 0.1%