[FFmpeg-devel] [PATCH 2/2] aacdec: correctly skip padding at the start of frames and during seeking
Lynne
dev at lynne.ee
Mon Oct 30 19:03:32 EET 2023
Oct 30, 2023, 08:38 by jb at videolan.org:
> Hello,
>
> Does this fix #2325 #9667?
>
It fully fixes the following:
- Decoding of MP4/M4A HE-AAC streams is delayed by 3009 samples
- Decoding of standalone ADTS AAC files generated by libavcodec's AAC encoder is delayed by 1024 samples
It partially fixes the following:
- Standalone ADTS AAC files generated by fdk-aac is delayed by 2048 samples (we cut 1024 with this patch)
- Standalone ADTS AAC files generated by apple's encoders is delayed by 2112 samples (we cut 1024 with this patch)
We cannot fix raw ADTS AAC in any way - with this patch, the decoder cuts off exactly the amount of samples demanded by the standard - 1024 for AAC-LC, and 4034 for HE-AAC. If the encoder adds more than this, it's the encoder's fault.
Does it fix "MP4 AAC Audio is delayed by 2ms when converted to PCM"?
Well, first of all, the title is wrong, 00:00:00.02 seconds is not 2 milliseconds, it is 20 milliseconds.
Second of all, it was not broken before? We strip off exactly what the MP4 editlist tells us to.
If the encoder or muxer's editlist is incorrect - we're going to cut off the wrong amount.
We also parse both editlists and itunes SMPB.
Does it fix "HE-AAC (not in mp4) decode samples off by one sample-time"
Yes, through this mechanism, I add a sample back in, which I forgot to do for this patch, but I've fixed it locally, and we're in sync:
Before: https://files.lynne.ee/aache_before.png
After: https://files.lynne.ee/aache_after.png
Original: https://files.lynne.ee/aache_orig.png
More information about the ffmpeg-devel
mailing list