Hi guys,
When converting DTS HD-MA or multichannel FLAC to AAC with the latest ffmpeg 4.1.3 I get channel layout that mismatch source audio file.
This happens for 5.1 and 7.1 audios.
The command I use is the simplest one:
Code:ffmpeg -i 7.1.flac 7.1.aacCode:ffmpeg -i 5.1.dts 5.1.aac
The source and destination layouts looks like the following:
Code:L R C LFE Lb Rb Ls Rs <-- 7.1.flac C L R Ls Rs Lb Rb LFE <-- 7.1.aacPlease kindly assist.Code:C L R Ls Rs LFE <-- 5.1.dts L R C Cb Lb Rb <-- 5.1.aac
+ Reply to Thread
Results 1 to 21 of 21
-
-
Sounds like serious regression for ffmpeg.
Try to restore proper order with https://ffmpeg.org/ffmpeg-filters.html#channelmap
Check channel layout for source and for target. -
Any update here? Does anyone know how to fix it?
I have DTS-HD MA 7.1:
Code:Channel layout : C L R LFE Lb Rb Lss Rss
Code:Channel layout : C L R Ls Rs Lw Rw LFE
Last edited by eddy89; 31st Mar 2025 at 12:41.
-
Thanks for the reply.
Can you develop on what is the meaning of the Lb Rb Lss Rss as opposed to Ls Rs Lw Rw?
DTS:
Code:Channel layout : C L R LFE Lb Rb Lss Rss
Code:Channel layout : C L R Ls Rs Lw Rw LFE
Apart from that, do you know why unless I add this to the command line:
Code:-ac 8
Code:Channel(s) : 7 channels Channel layout : C L R Ls Rs Lb Rb
Besides that, see the difference in the channels, apart from the lack of one of them, the naming is quite different:
Code:Channel(s) : 7 channels Channel layout : C L R Ls Rs Lb Rb Channel(s) : 8 channels Channel layout : C L R Ls Rs Lw Rw LFE
Hope anyone can put some light here.
ThanksLast edited by eddy89; 31st Mar 2025 at 13:58.
-
Which software gives you these channel names?
Apart from that, do you know why unless I add this to the command line:
Code:-ac 8
-
I was curious about this & searched it.
It is an Apple codec.
https://trac.ffmpeg.org/wiki/Encode/AAC
At the bottom of this web page under ffmpeg it has some limited information about using with ffmpeg build:
https://wiki.hydrogenaud.io/index.php?title=Apple_AACLast edited by cholla; 2nd Apr 2025 at 12:19.
-
I vaguely recall that Apple may use different default channel allocation in their AAC - ffmpeg may fail in autodetection - can't provide you link but im almost sure that this was on hydrogen forum. I would try to use channel remap filter on ffmpeg to restore proper channel allocation - perhaps configuring filter 'channelmap' in ffmpeg in proper way will improve this (signaling proper channel layout) - https://ffmpeg.org/ffmpeg-filters.html#channelmap ; https://trac.ffmpeg.org/wiki/AudioChannelManipulation#Remapchannels .
Btw ffmpeg recognize four different 7.1 channel layouts - not sure how many of them is supported by 'aac_at' codec - this can be also important. -
-
I have just tried this with the normal aac encoder from ffmpeg.
I then loaded the dts and the aac file into Audacity at the same time and checked the individual tracks; the channel layout is correct, the individual aac channels are exactly the same as in the dts file. -
You need to be sure that you are using proper channel layout - not sure if ffmpeg is able to automatically remap different channel layouts and depends on information source there are at least 3 different 7.1 channel layouts:
Code:7.1 FL+FR+FC+LFE+BL+BR+SL+SR 7.1(wide) FL+FR+FC+LFE+BL+BR+FLC+FRC 7.1(wide-side) FL+FR+FC+LFE+FLC+FRC+SL+SR
Code:7.1 FL+FR+FC+LFE+BL+BR+SL+SR 7.1(wide) FL+FR+FC+LFE+BL+BR+FLC+FRC 7.1(wide-side) FL+FR+FC+LFE+FLC+FRC+SL+SR 7.1(top) FL+FR+FC+LFE+BL+BR+TFL+TFR
-
Thanks pandy, I don't want to do any downmixing at all.
Wanna preserve all the channels.
Hope anyone can help me with encode DTS HD-MA 7.1 to AAC 7.1 (without losing any channel), here: https://forum.videohelp.com/threads/417937-Audio-DTS-conversion#post2772491Last edited by eddy89; 14th Apr 2025 at 13:54.
-
-
I am trying to replicate the configuration (with less bitrate cause is insane at almost 900k) of a given release group movie (tigole), which has a AAC 7.1, allegedly properly done.
Their configuration when I have a look in media info is this:
Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : A_AAC-2
Duration : 1 h 53 min
Bit rate : 897 kb/s
Channel(s) : 8 channels
Channel layout : C L R Ls Rs Lb Rb LFE
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 SPF)
Compression mode : Lossy
Delay relative to video : 20 ms
Stream size : 728 MiB (5%)
Language : English
Default : Yes
Forced : No
General
Complete name : /Users/legolas/Downloads/output.aac
Format : ADTS
Format/Info : Audio Data Transport Stream
File size : 418 MiB
Overall bit rate mode : Variable
Audio
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Format version : Version 4
Codec ID : 2
Bit rate mode : Variable
Channel(s) : 8 channels
Channel layout : C L R Ls Rs Lw Rw LFE
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 418 MiB (100%) -
I downloaded a file something like eddy89 has.
This is the MediaInfo on this file with the video removed:
Code:Audio ID : 1 Format : DTS XLL Format/Info : Digital Theater Systems Commercial name : DTS-HD Master Audio Codec ID : A_DTS Duration : 49 s 54 ms Bit rate mode : Variable Channel(s) : 8 channels Channel layout : C L R LFE Lb Rb Lss Rss Sampling rate : 96.0 kHz Frame rate : 187.500 FPS (512 SPF) Bit depth : 24 bits Compression mode : Lossless Language : English Default : Yes Forced : No
Code:Audio ID : 1 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : mp4a-40-2 Duration : 49 s 56 ms Source duration : 49 s 76 ms Bit rate mode : Constant Bit rate : 1 257 kb/s Channel(s) : 8 channels Channel layout : C L R Ls Rs Lb Rb LFE Sampling rate : 96.0 kHz Frame rate : 93.750 FPS (1024 SPF) Compression mode : Lossy Stream size : 7.35 MiB (100%) Source stream size : 7.35 MiB (100%) Language : English Default : Yes Alternate group : 1
These are the errors I get when I use -c:a aac_at in ffmpeg:
It appears that the Apple aac_at does not work with DTS-HD MA 7.1
Code:[aac_at @ 006d8940] AudioToolbox init error: 1718449215 [aost#0:0/aac_at @ 007114c0] [enc:aac_at @ 006d88c0] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height. [af#0:0 @ 006d9640] Error sending frames to consumers: Unknown error occurred [af#0:0 @ 006d9640] Task finished with error code: -1313558101 (Unknown error occurred) [af#0:0 @ 006d9640] Terminating thread with return code -1313558101 (Unknown error occurred) [aost#0:0/aac_at @ 007114c0] [enc:aac_at @ 006d88c0] Could not open encoder before EOF [aost#0:0/aac_at @ 007114c0] Task finished with error code: -22 (Invalid argument) [aost#0:0/aac_at @ 007114c0] Terminating thread with return code -22 (Invalid argument) [out#0/ipod @ 006d8340] Nothing was written into output file, because at least one of its streams received no packets.
Code:Audio Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Format version : Version 4 Codec ID : 2 Bit rate mode : Variable Channel(s) : 8 channels Channel layout : C L R Ls Rs Lw Rw LFE Sampling rate : 48.0 kHz Frame rate : 46.875 FPS (1024 SPF) Compression mode : Lossy Stream size : 2.76 MiB (100%)
Code:Audio ID : 1 Format : AAC LC Format/Info : Advanced Audio Codec Low Complexity Codec ID : mp4a-40-2 Duration : 49 s 56 ms Source duration : 49 s 76 ms Bit rate mode : Variable Bit rate : 469 kb/s Maximum bit rate : 512 kb/s Channel(s) : 8 channels Channel layout : C L R Ls Rs Lw Rw LFE Sampling rate : 48.0 kHz Frame rate : 46.875 FPS (1024 SPF) Compression mode : Lossy Stream size : 2.74 MiB (99%) Source stream size : 2.74 MiB (99%) Language : English Default : Yes Alternate group : 1
-
Find it here (sorry, they are the full files, not clips):
my compression with ProWo's command line.aac:
https://1fichier.com/?8ibyukvj2yooofcqdjaj
audio demuxed with mkvtoolnix from tigole group release.aac:
https://1fichier.com/?cuw2q9o8ih7j01zwfoxc
alleged original DTS 7.1 from another release.dts:
https://1fichier.com/?7c8oc5zpqx1ux3w9cd5m
Please have a look.
I don't know the meaning of lw and rw... Don't understand the difference. Can you elaborate and explain?
Weird, mine seems to work, the only problem is that it looses a channel.
Code:Input #0, dts, from '...whatever.dts': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Audio: dts (dca) (DTS-HD MA), 48000 Hz, 7.1, s32p (24 bit) Stream mapping: Stream #0:0 -> #0:0 (dts (dca) -> aac (aac_at)) Press [q] to stop, [?] for help Output #0, adts, to '/Users/blah/Downloads/output2b.aac': Metadata: encoder : Lavf61.7.100 Stream #0:0: Audio: aac, 48000 Hz, 7.0, s16, 512 kb/s Metadata: encoder : Lavc61.19.101 aac_at [out#0/adts @ 0x7fd3dd906e00] video:0KiB audio:425472KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.512698% size= 427653KiB time=01:53:27.48 bitrate= 514.6kbits/s speed=23.4x
Just installed the libfdk_aac, and when I use it, the channel layout is what you said: it is not the same as the default aac.
Related with that, when I use the "libfdk_aac" instead of the normal "aac", with ProWo's command line, the bitrate is not variable anymore, maybe the default configuration with the libfdk_aac is different than the standard?
Thank you very muchLast edited by eddy89; 17th Apr 2025 at 05:57.
-
I'm not sure eother.I believe that lw and rw are left wide & right wide.
I believe this is the same as lb & rb. Left back & Right back.
I believe on an amp these would come from the same jacks.
The positioning of the speakers might be a little different for the best listening.
An object-based format instead of an area based format.
Maybe a more knowledgeable member can explain this better.
It may be the sample file I'm using. I just got one from the internet.
I will see how it works when I download the last file you posted.
The site requires an hour wait between downloads.
This is a variation of ProWo's code:Give it a try
Code:ffmpeg -i input_dts_ma_8ch.dts -c:a libfdk_aac -vbr 5 output.aac OR ffmpeg -i input_dts_ma_8ch.dts -c:a libfdk_aac -vbr 5 output.m4a
-
I tried using fmpeg channelmap but it would not change the channel order on a aac_at.
Original DTS file: Channel layout: C L R LFE Lb Rb Lss Rss
Without the -ac 8 added to the code it always had 7 channels.
It left out the LFE channel.
Channel layout : C L R Ls Rs Lb Rb
With the -ac 8 added to the code it had the LFE channel
Channel layout : C L R LFE Lb Rb Lss Rss
Try this code:
Code:ffmpeg -i input.dts -c:a aac_at -aac_at_quality 0 -aac_at_mode vbr -b:a 512k -ac 8 output.aac
[Attachment 86640 - Click to enlarge]
This is a clip cut from the original.dts.
It is much smaller but MediaInfo reads it the same except for size.
Similar Threads
-
Downmixing 6 channel AAC to 2 channel?
By bizzybody in forum Video ConversionReplies: 33Last Post: 12th Nov 2017, 10:19 -
Convert 6 Channel AAC to 6 Channel AC3
By TheRandomOne in forum AudioReplies: 18Last Post: 4th Jul 2017, 10:40 -
Handbrake without FDK-AAC, new FFMPEG AAC encoder viable alternative?
By jaggy in forum Video ConversionReplies: 15Last Post: 27th Apr 2017, 10:31 -
How to see a 5.1 file's channel layout? + Channel layout error with ffmpeg
By HoraceMcMahon in forum AudioReplies: 30Last Post: 10th May 2016, 21:00 -
FFMpeg and channel layout
By alexander121 in forum AudioReplies: 4Last Post: 22nd Mar 2015, 02:27