Can a WebM encoder imply silence by omitting audio blocks?

24 views
Skip to first unread message

Chris Pearce

unread,
Jul 5, 2010, 1:11:01 AM7/5/10
to WebM Discussion
Can an encoder imply silence by omitting audio blocks? For example, if
I had an audio track with only one cluster containing the following Blocks:

Block 1: Timecode 2s, containing audio samples of duration 1s
Block 2: Timecode 4s, containing audio samples of duration 1s

So this media contains audio for time ranges [2,3) and [4,5), and
doesn't include audio data for time ranges [0,1), and [3,4). Is that a
valid encoding, or must the encoder include audio data (for example a
representation of PCM 0 values/bytes for silent parts) for the entire
duration of the media?

Background:

I work on WebM support in Firefox, and Firefox doesn't play this video
correctly:

http://people.mozilla.com/~faaborg/files/20100625-tabsOnTop/Tabs.webmvp8.webm

I think this is because the audio timestamps that our WebM parser
returns for Vorbis Blocks aren't the sum of the durations of all audio
samples decoded from preceding Vorbis Blocks plus the timecode of the
first Block of audio samples. We eventually audio underrun (at about
1:19) and playback stalls. I think this is because of the file is
encoded with "gaps" in the audio data, but even if it were a bug in our
WebM parser, I still need to be able to handle the gaps-in-audio case as
well.

I'm wondering if it's safe/valid to assume that the encoder is implying
there's silence when it omits audio blocks, or whether I should just
assume the file is invalid and calculate Blocks' timecodes as the
timecode of first Block + duration of samples in preceding blocks.

Thanks,
Chris Pearce.

Steve Lhomme

unread,
Jul 5, 2010, 3:31:26 AM7/5/10
to webm-discuss
Yes it in valid in Matroska to have audio gaps. It should probably be the same for WebM when used for/from live captures for example when the CPU is overloaded and frames/samples are lost.

That means on the player side you should account for such audio gaps. You can rely on the end timecode of the frame being played and the start timecode of the next frame to play. You can do that at the PCM level so you are sure that it's accurate, regardless of the codec used. The same issue can exist in ogg+theora+vorbis.

Steve


--
You received this message because you are subscribed to the Google Groups "WebM Discussion" group.
To post to this group, send email to webm-d...@webmproject.org.
To unsubscribe from this group, send email to webm-discuss...@webmproject.org.
For more options, visit this group at http://groups.google.com/a/webmproject.org/group/webm-discuss/?hl=en.


Chris Pearce

unread,
Jul 5, 2010, 4:42:26 AM7/5/10
to webm-d...@webmproject.org
Ok, cool, thanks very much!

Chris.
Reply all
Reply to author
Forward
0 new messages