Opened 7 months ago

Last modified 6 months ago

#11035 new defect

MPEG-4 ALS decoder seems capped at 2^28 bytes .mp4 file size

Reported by: H2Swine Owned by:
Priority: normal Component: avcodec
Version: 7.0 Keywords: mp4 als
Cc: H2Swine, MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

How to reproduce:
Pick a "sufficiently big" WAVE file.
Compress it with the MPEG-4 ALS reference decoder RM23 as found at http://web.archive.org/web/20120219094440/http://www.nue.tu-berlin.de/menue/forschung/projekte/beendete_projekte/mpeg-4_audio_lossless_coding_als/parameter/en/#230252
using the -MP4 parameter.
Check that the encoded .mp4 file exceeds 268435456 bytes. Then just try to decode it:

% ffmpeg -i slightlytoolongALSfile.mp4 throwaway.wav
ffmpeg version 7.0.1-essentials_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13.2.0 (Rev5, Built by MSYS2 project)

Output will be like the following:

[aist#0:0/mp4als @ 0000027da5867440] [dec:als @ 0000027da5862400] Error submitting packet to decoder: Invalid data found when processing input
[aist#0:0/mp4als @ 0000027da5867440] [dec:als @ 0000027da5862400] Decode error rate 1 exceeds maximum 0.666667
[aist#0:0/mp4als @ 0000027da5867440] [dec:als @ 0000027da5862400] Task finished with error code: -1145393733 (Error number -1145393733 occurred)
[aist#0:0/mp4als @ 0000027da5867440] [dec:als @ 0000027da5862400] Terminating thread with return code -1145393733 (Error number -1145393733 occurred)
[aost#0:0/pcm_s16le @ 0000027da5867dc0] No filtered frames for output stream, trying to initialize anyway.

Then shorten the WAVE file and try again. If the .mp4 file ends up less than 268435456 , ffmpeg should decode it just fine.
Try again with -l (for wasted bits) and if that reduces the file size, you might be able to encode more samples. Try with -i (force dual mono, increase file size), and you will have to crop off more samples from the WAVE before encoding, if ffmpeg is to handle it.

Change History (10)

comment:1 by H2Swine, 7 months ago

Others terminate like

[als @ 00000151a0ae71c0] quant_cof -65 is out of range. speed= 136x

(Not saying it is a world-dominating codec, and ffmpeg doesn't support neither float nor -z, but still, it wouldn't be bad to get fixed what one does claim to support, instead of leaving behind partly decoded files.)

comment:2 by MasterQuestionable, 7 months ago

Cc: MasterQuestionable added
Component: undeterminedavcodec
Keywords: mp4 als added

͏    Primarily used by what applications, I wonder?
͏    .
͏    The prominent formats seem to be that described in:
͏    https://github.com/MasterInQuestion/talk/discussions/3#discussioncomment-9376594

͏    Does mere remuxing again to MP4 work normally?
͏    E.g. ffmpeg -i "in.mp4" -c copy "out.mp4"

comment:3 by H2Swine, 7 months ago

Looks like remuxing hits another size constraint. 487 823 229 bytes remux fine, 947 942 263 bytes and it throws this error:

[in#0/mov,mp4,m4a,3gp,3g2,mj2 @ 00000211d3001680] Error during demuxing: Cannot allocate memory
[out#0/mp4 @ 00000211d30125c0] video:0KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
[out#0/mp4 @ 00000211d30125c0] Output file is empty, nothing was encoded

(Primarily used by ... people who throw another codec into testing. ALS has choice of two residual encoding methods, and does surprisingly good on some particular signals.)

Last edited 7 months ago by H2Swine (previous) (diff)

comment:4 by Balling, 7 months ago

"Error during demuxing: Cannot allocate memory"

How much RAM do you have?

comment:5 by H2Swine, 7 months ago

16 GB + 16 GB swap/virtual

No problem with other codecs.

comment:6 by Balling, 7 months ago

It is funny I never heard about Audio lossless coding in my life. Haha.

in reply to:  6 comment:7 by H2Swine, 7 months ago

quant_cof out of range was already reported in #5942.

@Balling:

It is funny I never heard about Audio lossless coding in my life. Haha.

Seems it was only used in research papers - but once upon a time there was an attempt to make FFmpeg encode to it, even: https://github.com/justinruggles/FFmpeg-alsenc

I don't see much point in promoting the codec zealously, but one could fix bugs to the decoders that are taken on board.

comment:8 by Balling, 6 months ago

Can you attach the needed sample in #5942?

comment:9 by Balling, 6 months ago

And with CDDA.

What does that mean? See that issue again. CDDA is for CD music?

comment:10 by H2Swine, 6 months ago

I replied in #5942 - it might be that the error is elsewhere.
CDDA = 44100/16 in 2 channels. The original ticket 5942 says "no such problem with mono/stereo files", that is why.

Version 0, edited 6 months ago by H2Swine (next)
Note: See TracTickets for help on using tickets.