Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Channel Coupling #69

Closed
Tracked by #115
NoSuck opened this issue Dec 31, 2020 · 5 comments
Closed
Tracked by #115

Channel Coupling #69

NoSuck opened this issue Dec 31, 2020 · 5 comments

Comments

@NoSuck
Copy link

NoSuck commented Dec 31, 2020

Deleting a partially formed M4A file's header up to the "mdat" and attempting to decode results in the following:

■ uname -srvmo
Linux 5.9.11-arch2-1 #1 SMP PREEMPT Sat, 28 Nov 2020 02:07:22 +0000 x86_64 GNU/Linux
■ faad test.m4a 
 *********** Ahead Software MPEG-4 AAC Decoder V2.10.0 ******************

 Build: Oct 20 2020
 Copyright 2002-2004: Ahead Software AG
 http://www.audiocoding.com
 bug tracking: https://sourceforge.net/p/faac/bugs/
 Floating point version

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License.

 **************************************************************************

test.m4a file info:
RAW

Error: Channel coupling not yet implemented

Are there known workarounds? Thank you.

@NoSuck
Copy link
Author

NoSuck commented Sep 15, 2022

Thank you. How might I determine this? I notice 0x80 closing bytes in either file, with heads looking like this:

Original:

00: 0000 0018 6674 7970 6d70 3432 0000 0000  ....ftypmp42....
10: 6d70 3431 6973 6f6d 0000 0045 7575 6964  mp41isom...Euuid
20: 5ca7 08fb 328e 4205 a861 650e ca0a 9596  \...2.B..ae.....
30: 0000 0029 362e 332e 3936 3531 2e30 2028  ...)6.3.9651.0 (
40: 7769 6e62 6c75 6570 686f 6e65 5f72 746d  winbluephone_rtm
50: 2e31 3430 3532 312d 3135 3330 2900 0000  .140521-1530)...
60: 006d 6461 7400 0000 0000 0000 1027 0c54  .mdat........'.T
70: 8205 8241 4110 5024 2409 2102 5d10 c2c8  ...AA.P$$.!.]...
80: 421a 202c 8000 4041 c1f4 a3e5 f6ee 7ae6  B. ,..@A......z.
90: d5f7 e7e8 5ebb bbf2 b5cf cb9a 8e7c bf88  ....^........|..
a0: 1ce6 6b9e 525a 67f3 955f 4739 97ce fcfb  ..k.RZg.._G9....
b0: 99f2 979d ce67 79f2 faee 7399 ae77 39a8  .....gy...s..w9.
c0: 6656 8c89 9ae7 8b9b 7332 aa07 2610 3ead  fV......s2..&.>.
d0: cc99 ae74 7350 f44a dce6 56b9 d1cd b9ec  ...tsP.J..V.....
e0: ad40 e4cb e78a 1dce 656a 0739 96f4 4adc  .@......ej.9..J.
f0: c99a e744 fb9e cad6 e726 6b9e 29f7 332b  ...D.....&k.).3+

Deleted up to and including “mdat” (test.m4a from previous example):

00: 0000 0000 0000 0010 270c 5482 0582 4141  ........'.T...AA
10: 1050 2424 0921 025d 10c2 c842 1a20 2c80  .P$$.!.]...B. ,.
20: 0040 41c1 f4a3 e5f6 ee7a e6d5 f7e7 e85e  .@A......z.....^
30: bbbb f2b5 cfcb 9a8e 7cbf 881c e66b 9e52  ........|....k.R
40: 5a67 f395 5f47 3997 cefc fb99 f297 9dce  Zg.._G9.........
50: 6779 f2fa ee73 99ae 7739 a866 568c 899a  gy...s..w9.fV...
60: e78b 9b73 32aa 0726 103e adcc 99ae 7473  ...s2..&.>....ts
70: 50f4 4adc e656 b9d1 cdb9 ecad 40e4 cbe7  P.J..V......@...
80: 8a1d ce65 6a07 3996 f44a dcc9 9ae7 44fb  ...ej.9..J....D.
90: 9eca d6e7 266b 9e29 f733 2b5c ee73 51cf  ....&k.).3+\.sQ.
a0: 967d ce4c d73a 3996 ccaa dce4 cbe7 42a8  .}.L.:9.......B.
b0: 6655 408e 65f3 a154 3265 408e 6a1e caad  fU@.e..T2e@.j...
c0: cc99 ae74 4f43 32aa 0739 9704 53d0 ccad  ...tOC2..9..S...
d0: 408e 65b2 256e 64cd 73a3 9a86 6554 0c9b  @.e.%nd.s...eT..
e0: 27c2 bbfd 73f4 5fa5 79da 4001 0c3f 21c0  '...s._.y.@..?!.
f0: 270c 5499 8602 8120 b050 4424 090d 06e1  '.T.... .PD$....

Not-partially-formed M4A file from same source; faad handles this one fine:

00: 0000 0018 6674 7970 6d70 3432 0000 0000  ....ftypmp42....
10: 6d70 3431 6973 6f6d 0000 0045 7575 6964  mp41isom...Euuid
20: 5ca7 08fb 328e 4205 a861 650e ca0a 9596  \...2.B..ae.....
30: 0000 0029 362e 332e 3936 3531 2e30 2028  ...)6.3.9651.0 (
40: 7769 6e62 6c75 6570 686f 6e65 5f72 746d  winbluephone_rtm
50: 2e31 3430 3532 312d 3135 3330 2900 48ac  .140521-1530).H.
60: 566d 6461 7400 0000 0000 0000 1027 0c54  Vmdat........'.T
70: 8105 0658 1a8d 1085 9642 1080 0040 41df  ...X.....B...@A.
80: c37d 1b72 fa39 cdbb 9f2f 36e7 32b5 ce8e  .}.r.9.../6.2...
90: 6a39 f2cf b9c9 9ae7 8b9b 73d9 5503 932f  j9........s.U../
a0: 9e29 f733 2b50 39cc b7a2 56e6 4cbe 744e  .).3+P9...V.L.tN
b0: b132 a001 6689 4b00 1400 1611 7374 adf6  .2..f.K.....st..
c0: 4e08 cf9d a3aa f151 d2b4 b4d7 8cf9 a555  N......Q.......U
d0: a6bf 49ad d172 17e9 5a5a 6ba7 02ab 4f52  ..I..r..ZZk...OR
e0: 215b da6b 942b 7289 3dd6 9eab f4af 3b74  ![.k.+r.=.....;t
f0: aad3 24a5 a55b a7ce fd03 55c3 a02e 52dd  ..$..[....U...R.

facmwfa.latm:

00: 56e1 7b20 0023 901f e7fb a108 0028 0500  V.{ .#.......(..
10: dffe 0000 0000 0000 0000 0000 0000 0000  ................
20: 0000 0000 0000 0000 0000 0000 0000 0000  ................
30: 0000 0000 0000 0000 0000 0000 0000 0000  ................
40: 0000 0000 0000 0000 0000 0000 0000 0000  ................
50: 0000 0000 0000 0000 0000 0000 0000 0000  ................
60: 0000 0000 0000 0000 0000 0000 0000 0000  ................
70: 0000 0000 0000 0000 0000 0000 0000 0000  ................
80: 0000 0000 0000 0000 0000 0000 0000 0000  ................
90: 0000 0000 0000 0000 0000 0000 0000 0000  ................
a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................

Possibly of note: The latest HEAD produces a different error than it did two years ago:

$ ./faad test.m4a
 *********** Ahead Software MPEG-4 AAC Decoder V2.10.0 ******************

 Build: Sep 15 2022
 Copyright 2002-2004: Ahead Software AG
 http://www.audiocoding.com
 bug tracking: https://sourceforge.net/p/faac/bugs/
 Floating point version

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License.

 **************************************************************************

test.m4a file info:
RAW

Error: Scalefactor out of range

@enzo1982
Copy link

You cannot just cut away everything up to the mdat marker and expect the file to decode. What comes after mdat are usually raw AAC frames. These are missing the encoder specific config (ESC) that is stored in the mp4a box in MP4 files and contains information needed to properly set up the decoder.

Plain .aac files, on the other hand, usually contain an ADTS stream that embeds the ESC into frame headers. Other formats for .aac files are ADIF and LATM. But you cannot convert an .mp4/.m4a file to any of these formats simply by cutting something off the beginning of the file.

The only case in which this might work is if the MP4 file does contain LATM packets and the ESC is multiplexed into the packets. This is a possible scenario, but would be extremely rare.

Anyway, in your case, there are no LATM packets. Your file with the cut-off head is missing the LATM sync bits, so it's probably just raw AAC frames. The LATM sync signature is 0x56E or 0x56F (only the first 11 bits are considered) and can be seen in the file provided by @ValZapod, but not in your file.

You are basically feeding random data to faad here. This is not a faad issue.

@eustas
Copy link
Contributor

eustas commented May 2, 2023

@fabiangreffrath: according to @enzo1982 comment we can close this issue; channel coupling is still not implemented, but that would be a feature request, not a bug.

@fabiangreffrath
Copy link
Collaborator

Well then...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@eustas @fabiangreffrath @enzo1982 @NoSuck and others