[vlc-devel] Matroska, libopus and loophole in the spec

Denis Charmet typx at dinauz.org
Tue Nov 5 02:09:17 CET 2013


I've been adding Opus support in Matroska using mainly two samples
apparently muxed by lavf and mkvmerge. I have no issue when using lavc
opus decoder but when I use vlc's based on libopus, I have no sound.

Putting aside the header issues, especially the OpusTags that is
stripped to avoid redundancy with matroska's tags; the main issue is
that the lib opus expect a framesize in sample in the function

To calculate this I have to know the block duration, this could be done
using the DefaultDuration in the TrackEntry (when using SimpleBlocks) or
the Duration field of the BlockGroup but in my case, none of my sample
actually specify those values.

Is there a way to bypass the framesize limitation? Should I wait for the
next frame of the same track to get the duration knowing that this will
fail for the last frame? Should I create a VLC_CODEC_OPUS_AVCODEC that
will force the use of lavc to decode without the restrictions?

For the record I have the same kind of issues with libflac when the
durations set in the file are not reliable which will happen a day or

Any insight would be great.

Also the decoder seems to compare p_block->i_length and
p_block->i_nb_sample without multiplying/dividing by the rate.


Denis Charmet - TypX
Le mauvais esprit est un art de vivre

More information about the vlc-devel mailing list