[FFmpeg-user] AC3 decoding throws error number -16976906 ... vlc plays well

Ferdi Scholten ferdi at sttc-nlp.nl
Sat Dec 24 14:21:00 EET 2022


On 23-12-2022 17:39, Mahesh Velankar wrote:
> I did some research on this and downloaded ffmpeg and tried to find where
> the error is getting thrown from.
>
> Here is the file:
> libavcodec/ac3_parser.c
>
>   76 int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
>   77 {
>   78     int frame_size_code;
>   79
>   80     memset(hdr, 0, sizeof(*hdr));
>   81
>   82     hdr->sync_word = get_bits(gbc, 16);
>   83     if(hdr->sync_word != 0x0B77)
>   84         return AAC_AC3_PARSE_ERROR_SYNC;
>
> AAC_AC3_PARSE_ERROR_SYNC is 16976906 in decimal
>
> How do I proceed from here?
> How can I fix this? Should I fix the code or the audio stream file?
> I feel, stream file should not be touched, because
> 1, it is coming from outside and not in my control and
> 2. VLC does not have any issue with that stream, then why should ffmpeg
> have?
>
> So how can this code be fixed?
> Please help me
> Thank you
>
It simply means that the encoded audio is not compliant to the AC3 
standard. It is missing the 0B77 signature in the sync part of the 
header of the frames.

However the container or stream (in your case an mpeg transport stream) 
also has a description of the audio stream and it told the decoder it is 
AC3. (as specified in Annex A of the AC3 standard). That is why VLC 
probably still plays the audio, even if the stream is missing the sync 
part (and probably also other header information)

Only way to make sure is to extract the audio and analyze the structure 
of the frames. Most likely, you need to fix the audio, not the ffmpeg code.

Also of interest is trying to find out if VLC is complaining about this. 
It actively suppresses error output unless you specifically set it. This 
is okay for normal use as a player that should try to play the stream 
with known settings, even if there are issues with it. You can enable 
logging in VLC in the advanced preferences.


More information about the ffmpeg-user mailing list