Open Bug 1321249 Opened 8 years ago Updated 2 years ago

Properly handle AAC/MP4 encoder delay

Categories

(Core :: Audio/Video: Playback, defect, P3)

defect

Tracking

()

People

(Reporter: jya, Assigned: padenot)

References

Details

Attachments

(1 file)

See https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html Also found in ISO 14496-12. AAC has traditionally had a default encoder delay set at 2112 frames. This is an implicit encoder. Additionally, there's in the MP4 container an explicit encoding to define the encoder delay There are two boxes to handle such information: sample group description box (sgpd) and sample-to-group (sbgp) This is in additional to an eventual edit list. Stagefright appears to have handling for all of those and set some keys kKeyEncoderDelay kKeyEncoderPadding we should handle this with the rust demuxer, and then modify all the decoders to trim the frames on both ends.
See Also: → 1345756
Hi Jean-Yves, here's a test case of AAC with elst box: https://github.com/nzhang227/gapless_audio_mse#details-about-the-test-files. There's details on the transcoding and elst box generation. Could you take a look and see if you can make the test case work? Please feel free to ask any questions.

AAC has traditionally had a default encoder delay set at 2112 frames.

For apple. FFmpeg native encoder uses 1024 samples. HE-AAC and v2 of it use again different amount of samples. There is also a problem with samples in the end.

There are two boxes to handle such information: sample group description box (sgpd) and sample-to-group (sbgp)

No, those signal how many samples should decoded to correctly decode further samples. In case of aac it is 1 samples, so 1024 samples cannot be just removed.

Please note a key commit in ffmpeg that fixed wrong intial priming removal for HE-AAC. https://github.com/FFmpeg/FFmpeg/commit/5114ce1e2a4c71ddf4971ad3cf9bd43ae16571c3

Severity: normal → S3
Assignee: nobody → padenot
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: