OGG read failure


#1

I have two OGG files here created with the same encoder. Both play with VLC and decode with oggdec.

However, one of them reports a zero length when loaded with the JUCE decoder (and also crashes the demo app) and the other does not.

Anyone seen any similar problems? I have a good few examples of these! I don’t know if it’s an encoding or decoding problem…

 $ ogginfo *ogg
Processing file "53884c2935e6b47938f91ca78b0c2473a85730833138370caedbb66a74995130.ogg"...

New logical stream (#1, serial: 7cf3a216): type vorbis
Vorbis headers parsed for stream 1, information follows...
Version: 0
Vendor: Lavf53.32.100
Channels: 2
Rate: 44100

Nominal bitrate: 112.000000 kb/s
Upper bitrate not set
Lower bitrate not set
User comments section follows...
	encoder=Lavf53.32.100
Vorbis stream 1:
	Total data length: 477236 bytes
	Playback length: 0m:28.000s
	Average bitrate: 136.351376 kb/s
Logical stream 1 ended
Processing file "d7d5ef8e6c7fad33f922924d0a05591277654d53941d43518f1fe8580c7ea3f9.ogg"...

New logical stream (#1, serial: 4cc3ef76): type vorbis
Vorbis headers parsed for stream 1, information follows...
Version: 0
Vendor: Lavf53.32.100
Channels: 2
Rate: 44100

Nominal bitrate: 112.000000 kb/s
Upper bitrate not set
Lower bitrate not set
User comments section follows...
	encoder=Lavf53.32.100
Vorbis stream 1:
	Total data length: 486627 bytes
	Playback length: 0m:26.000s
	Average bitrate: 149.728251 kb/s
Logical stream 1 ended

Specifically, this function returns 0 for the troublesome example:

/* returns: total PCM length (samples) of content if i==-1 PCM length
            (samples) of that logical bitstream for i==0 to n
            OV_EINVAL if the stream is not seekable (we can't know the
            length) or only partially open
*/
ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i){
  if(vf->ready_state<OPENED)return(OV_EINVAL);
  if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
  if(i<0){
    ogg_int64_t acc=0;
    int i;
    for(i=0;i<vf->links;i++)
      acc+=ov_pcm_total(vf,i);
    return(acc);
  }else{
    return(vf->pcmlengths[i*2+1]);
  }
}

#2

I’ve posted to the ogg dev list…


#3

Okay for the record - this is an encoding bug.

Specifically the ffmpeg encoder appears to not always close the vorbis encoder properly … we are still investigating. If anyone needs an OGG file hex dumping and decoding … I am now an expert…


#4

Any Resolution on this? Seeing bad OGG files similar to what you are reporting.


#5

We are moving to a different OGG encoder.

I think this one:

https://wiki.xiph.org/Vorbis-tools

See if that helps.

If you have existing OGG files you need to play with this problem I don’t have any bright ideas, it’s probably possible but not if you call ov_pcm_total as is done in the JUCE decoder.


#6

I’m confused: JUCE uses libvorbis from Xiph.org already. Isn’t it a matter of updating JUCE’s Ogg library? (Or writing a not-so-ugly-assed codec…)


#7

The problem was the ‘encoding’ using ffmpeg. This produced an invalid ogg file, for which calling ov_pcm_total fails. JUCE depends on ov_pcm_total during decoding.