#7011 closed defect (fixed)
Decoding of chained opus streams isn't properly supported
Reported by: | neknek446 | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | unspecified | Keywords: | opus ogg |
Cc: | 166291@gmail.com, epirat07@gmail.com | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
ffmpeg currently doesn't support chained opus streams (as specified in <https://tools.ietf.org/html/rfc7845.html#section-7.2>).
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:
wget https://jmvalin.ca/misc_stuff/chain_works.opus ffmpeg -i chain_works.opus chain_works.wav
or
mpv https://jmvalin.ca/misc_stuff/chain_works.opus
or
mplayer https://jmvalin.ca/misc_stuff/chain_works.opus
Also relevant VLC ticket: <https://trac.videolan.org/vlc/ticket/18401>.
Attachments (1)
Change History (9)
comment:2 by , 7 years ago
https://github.com/FFmpeg/FFmpeg/commit/c994bb2fb7727f5c20ef71cc6727fb219fd49d60 apparently intentionally disabled codec reinitialisation.
comment:3 by , 7 years ago
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 by , 7 years ago
there's ticket (https://github.com/MusicPlayerDaemon/MPD/issues/70) and not yet accepted PR (https://github.com/MusicPlayerDaemon/MPD/pull/205) for mpd.
I'm "cathugger" in there.
comment:5 by , 5 years ago
This causes issues with web radios that chain opus files.
You can reproduce this issue easily using these commands:
ffmpeg -v 9 -loglevel 99 -f lavfi -i "sine=frequency=1000:duration=5" -c:a libopus a.ogg ffmpeg -v 9 -loglevel 99 -f lavfi -i "sine=frequency=2000:duration=5" -c:a libopus b.ogg cat a.ogg b.ogg > c.ogg ffplay -v 9 -loglevel 99 -nodisp c.ogg 2>&1 | tee opus_chained_errors.log
by , 5 years ago
Attachment: | opus_chained_errors.log added |
---|
Log of ffplay attempting to play a chained opus file
comment:6 by , 5 years ago
Cc: | added |
---|
comment:7 by , 5 years ago
Cc: | added |
---|
comment:8 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in 8296443a70f052a6f5c9a867d28b83a5eb7d304d.
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?).