Opened 19 months ago

Last modified 19 months ago

#7011 new defect

Decoding of chained opus streams isn't properly supported

Reported by: neknek446 Owned by:
Priority: normal Component: avformat
Version: unspecified Keywords: opus ogg
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
ffmpeg currently doesn't support chained opus streams (as specified in <>).
When decoding opus stream with OpusHead/OpusTags packets not in begining of overall stream, it produces "Error parsing the packet header." error messages and crack noises, and also doesn't update tags.
For opus stream chaining to work, opus decoder (libavformat/oggparseopus.c) should:

  • handle OpusHead packets (including discarding pre-skip ammount of samples). It currently handles this well only in opus_header function.
  • handle OpusTags packets (including updating metadata). It currently handles this well only in opus_header function.
  • handle EOS-marked packets with granule position smaller than last granule position + ammount of samples contained in packet by discarding excess decoded samples. I looked at code and it seems to currently do this already.

How to reproduce:

ffmpeg -i chain_works.opus chain_works.wav





Also relevant VLC ticket: <>.

Change History (4)

comment:1 Changed 19 months ago by neknek446

I'm not really familiar with codebase so I can't really tell whether oggparseopus.c' opus_packet() should be chagned to handle this or something in oggdec.c should be modified to make it call os->codec->header() (os->header = -1; in ogg_replace_stream() maybe?).

Last edited 19 months ago by neknek446 (previous) (diff)

comment:2 Changed 19 months ago by neknek446 apparently intentionally disabled codec reinitialisation.

comment:3 Changed 19 months ago by atomnuker

Do any chained opus streams actually exist or is it just that file? Last I looked at it it was just that file.

comment:4 Changed 19 months ago by neknek446

there's ticket ( and not yet accepted PR ( for mpd.
I'm "cathugger" in there.

Note: See TracTickets for help on using tickets.