[vorbis] vcut breaks song index ? XMMS search fails

Arc arc at indymedia.org
Wed Aug 27 16:20:41 PDT 2003


On Thu, Aug 28, 2003 at 03:09:07AM +0200, Sebastien Cevey wrote:
> 
> Here is a simple recipe to reproduce the problem (I do not say bug for
> I'm not sure it is one) :
> 
> $ # Let orig.ogg be the original ogg file
> $ vcut orig.ogg part1.ogg rest.ogg 1000000
> $ vcut rest.ogg part2.ogg part3.ogg 1000000
> $ xmms part?.ogg
> 
> part1.ogg and part3.ogg are "searchable", but part2.ogg isn't.
> 
> It seems like the file containing the beginning and the end don't have
> the problem, but the middle files do.

I found the same problem.  Suggest using py-ogg to diagnose this, since
vcut works on the Ogg layer (I dont think it even works with packets).

Basically, vcut works on the principal that granulepos (a header field)
specifies the last sample that's suppost to be decoded.  If it's a
negetive number, it means "skip this number of samples".  It's the
latter that this problem is caused by.

When you cut orig.ogg into part1 and rest, part1 is the first chuck of
the file up to a certain granulepos with the last page's granulepos set
to the cut point. rest has the header pages (page 0 and 1) followed by
the last page included in part1 followed by the remaining file.  Yes,
there is a 1 page overlap.  The first page of rest.ogg has a negetive
granulepos equal to the cut point minus the origional granulepos of that
page.  Pretty simple, works good.

The confusion comes from when you use vcut to cut a file that's not
"origional".  Yes, the tail will cut correctly, but the first part of
the remainer will always be messed up.  I do not believe this to be a
player problem, since the granulepos's seem mangled, it appears to be an
issue with vcut.

So there's two ways you can work around this.  First, you can always cut
from the origional, but that limits you.  

The other thing you can do is use a python-based program to cut based on
granulepos.  Just keep the first two pages in memory and go through
chopping out whole pages and placing the page ranges in a file after the
first two header pages.  You don't have to even do anything to these
pages, it's legal to skip granules/pages in the beginning of a stream.

If you want to paste these together you will need to change the serialno
of the bitstreams, treating the different segments as chained
bitstreams.

I hope that's enough info.  If you need help using the python tools I'd
be happy to provide more assistance on irc.xiph.org in #Python

<p><p>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: part
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/vorbis/attachments/20030827/20e9a294/part-0001.pgp


More information about the Vorbis mailing list