IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
ogg-vorbis bitstream question, header ?
sn0wman
post Oct 28 2005, 16:56
Post #1





Group: Members
Posts: 82
Joined: 3-February 05
Member No.: 19557



hey, i am working on an ogg-vorbis support for my program, and i am curious if the firsth page is always 58 bytes long, and if its funcionality can be taken as a header (like mpc, flac, mp3 etc has). or do i have to seek for segment table and iterate through the lacing values/segments ?
[EDIT]
[...] values/segments to determine its (1th page) size ?
i am asking becouse i want to reach the vorbis comment.

This post has been edited by sn0wman: Nov 2 2005, 20:12
Go to the top of the page
+Quote Post
sn0wman
post Mar 17 2006, 13:32
Post #2





Group: Members
Posts: 82
Joined: 3-February 05
Member No.: 19557



for a long time i wasn't working on this (OGG) parts in my code so i dont even remember what's post above about, but i remember that sometimes after posting that, i realized that it (question) could be asked in an all wrong way. whatever, i am asking again and simplier:
is anyone able and willing to help me determining where the vorbis comment is ???
i need:
- offset from the begining of file
- size comment

hopefully waiting for an answer rolleyes.gif , sn0wman
Go to the top of the page
+Quote Post
illiminable
post Mar 20 2006, 04:45
Post #3





Group: Members
Posts: 36
Joined: 1-July 04
From: Australia
Member No.: 15011



QUOTE (sn0wman @ Mar 17 2006, 08:32 PM)
for a long time i wasn't working on this (OGG) parts in my code so i dont even remember what's post above about, but i remember that sometimes after posting that, i realized that it (question) could be asked in an all wrong way. whatever, i am asking again and simplier:
is anyone able and willing to help me determining where the vorbis comment is ???
i need:
- offset from the begining of file
- size comment

hopefully waiting for an answer  rolleyes.gif , sn0wman
*


The comment will always begin as the first packet in the second page of the vorbis stream. ie the second packet in the stream.

The size of the comment is variable not fixed.

The comment can span over multiple pages. Though in most cases it is fully contained in the second page. You can't rely on this though.

The only reliable way to get the comment, is to packetise the first 2 packets. ie use an ogg demuxer (ie libogg), or to use the lacing values to determine where the packet is, and if it spans over page breaks to merge the parts together.
Go to the top of the page
+Quote Post
sn0wman
post Mar 27 2006, 19:04
Post #4





Group: Members
Posts: 82
Joined: 3-February 05
Member No.: 19557



oh cool, thanks illiminable, i have even found some code which i can learn on. but, do you know maybe, to be sure, if firsth page always count only one segment (which is identification header [0x01]) ? thats what implicates from what i see in that code, and, all my files i looked up, are build in that way.

This post has been edited by sn0wman: Mar 27 2006, 19:07
Go to the top of the page
+Quote Post
sn0wman
post Mar 28 2006, 11:14
Post #5





Group: Members
Posts: 82
Joined: 3-February 05
Member No.: 19557



another question, i need to be 100% sure, does vorbis comment field size can be span over more than 1 page (like field content can be), or its just impossible ?
Go to the top of the page
+Quote Post
xiphmont
post May 12 2007, 11:23
Post #6


Xiph.org


Group: Developer
Posts: 166
Joined: 24-September 01
Member No.: 16



QUOTE (sn0wman @ Mar 28 2006, 06:14) *
another question, i need to be 100% sure, does vorbis comment field size can be span over more than 1 page (like field content can be), or its just impossible ?


The packet can span multiple pages and it can be split at any point. So, yes, the field size could also be split.

Monty
Go to the top of the page
+Quote Post
maacruz
post Jun 9 2007, 23:51
Post #7





Group: Members
Posts: 16
Joined: 13-November 04
Member No.: 18120



I'd suggest you to have a look at mutagen python library
Go to the top of the page
+Quote Post
paultaylor
post Aug 9 2007, 21:32
Post #8





Group: Members
Posts: 109
Joined: 27-January 05
Member No.: 19366



Hi ive read and reread the ogg and vorbis documents on Xiph.org but Im still unsure about a couple of terms.

When using Ogg Vorbis what exactly is a packet, is it eight bits (an octet), or are there three packets (the Identification packet, Vorbis Comment packet and Audio Packet).

I understand that Vorbis Comment can span multiple pages but how do you detect this. I thought I could look for where the Ogg Page header type flag was 1, and carry on reading pageheaders until the header type is zero, but oce I get one page with a header flag=1, they seem to continue with a flag=1 until the very last frame.
Go to the top of the page
+Quote Post
Lear
post Aug 9 2007, 22:20
Post #9


VorbisGain developer


Group: Developer
Posts: 137
Joined: 10-January 02
Member No.: 973



QUOTE (paultaylor @ Aug 9 2007, 22:32) *
Hi ive read and reread the ogg and vorbis documents on Xiph.org but Im still unsure about a couple of terms.

When using Ogg Vorbis what exactly is a packet, is it eight bits (an octet), or are there three packets (the Identification packet, Vorbis Comment packet and Audio Packet).

I was also confused about this at first. A packet is a block of data of arbitrary length, padded to an integral number of bytes. To find the size, look at the segment table. Lets say it contains 12 entries (called lacing values), and the value of the first 4 entries are 255, 255, 255 and 135. That means the first packet on that page is 255 * 3 + 135 (i.e., 900) bytes.

QUOTE
I understand that Vorbis Comment can span multiple pages but how do you detect this. I thought I could look for where the Ogg Page header type flag was 1, and carry on reading pageheaders until the header type is zero, but oce I get one page with a header flag=1, they seem to continue with a flag=1 until the very last frame.

The continue bit indicates that a packet continues from the previous page, but it doesn't say anything about which packet...

Again, look at the segment table. The end of a packet is marked with an entry that is less than 255. If the table ends with a 255 value, it means the packet continues on the next page (and that page should have the continued flag set).
Go to the top of the page
+Quote Post
paultaylor
post Aug 10 2007, 07:35
Post #10





Group: Members
Posts: 109
Joined: 27-January 05
Member No.: 19366



QUOTE (Lear @ Aug 9 2007, 22:20) *
That means the first packet on that page is 255 * 3 + 135 (i.e., 900) bytes.

Thanks. If that signifies the end of the first packet on that page. How does is show a second packet on that page or do packets always start on a new page. In particular does the Ogg Vorbis Decode Header start on the same page as the end of the Vorbis Comment Header page or the next page ?
Go to the top of the page
+Quote Post
Lear
post Aug 10 2007, 09:45
Post #11


VorbisGain developer


Group: Developer
Posts: 137
Joined: 10-January 02
Member No.: 973



Keep looking in the segment table. In my example there were 12 entries in it and the first packet used the first 4. The remaining 8 are used for further packets.
Go to the top of the page
+Quote Post
paultaylor
post Aug 10 2007, 10:20
Post #12





Group: Members
Posts: 109
Joined: 27-January 05
Member No.: 19366



QUOTE (Lear @ Aug 10 2007, 09:45) *
Keep looking in the segment table. In my example there were 12 entries in it and the first packet used the first 4. The remaining 8 are used for further packets.

Thanks Ive got it now, just need to code it.
Go to the top of the page
+Quote Post
paultaylor
post Aug 10 2007, 18:07
Post #13





Group: Members
Posts: 109
Joined: 27-January 05
Member No.: 19366



Ok, just a couple more questions.

Can I safetly assume that only the Identification Header is held on the first OggPage, or would it be valid to also start the VorbisComment Header on this page immediately afterwards.

The VorbisComment Header always seems to start on the 2nd page, with the Setup Header immediately after it.
But do the first Audio packets always start on their own new page (3rd page being the earliest) or could they start immediately after the Setup Header. I don't need to know this for reading VorbisComents but I do for writing VorbisComments.

thanks Paul
Go to the top of the page
+Quote Post
paultaylor
post Aug 14 2007, 07:31
Post #14





Group: Members
Posts: 109
Joined: 27-January 05
Member No.: 19366



In the absense of any other info Im assuming this is correct, it works ok for my testdata
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 26th May 2013 - 10:28