Help - Search - Members - Calendar
Full Version: OGG/VORBIS technical data wanted
Hydrogenaudio Forums > Lossy Audio Compression > Ogg Vorbis > Ogg Vorbis - General
treech
Hi, i'm about to read upp on my c/c++ skills and decided to do some kind of program, just for fun, that reads out the average bitrate/time/whatever of a OGG file.

now to my question... is there something like this:
http://www.dv.co.yu/mpgscript/mpeghdr.htm

for vorbis ? haven't found anything like that anywhere .. :mad:
would be really great...
biggrin.gif
Case
Vorbis isn't really well documented, I think it's best to use libvorbis for your task. Check http://www.xiph.org/ogg/vorbis/doc/vorbisfile/overview.html.
treech
sad.gif
does not help me much, does not say in what order stuff comes ... oh well, i'll do some more digging...
Case
CODE


#include <vorbis/vorbisfile.h>



int main (int argc, char** argv)

{

   FILE*           fp;

   OggVorbis_File  vf;

   vorbis_info*    vi;

   vorbis_comment* vc;

   double          duration;

   long            bitrate;



   if ( (fp = fopen ( argv[1], "rb" )) == NULL ) {

       return 1;

   }

   if ( ov_open (fp, &vf, NULL, 0 ) != 0 ) {

       return 1;

   }



   vi          = ov_info       ( &vf, -1 );

   duration    = ov_time_total ( &vf, -1 );

   bitrate     = ov_bitrate    ( &vf, -1 );

   vc          = ov_comment    ( &vf, -1 );



   if ( duration == OV_EINVAL )

       duration = 0;

   if ( bitrate == OV_EINVAL || bitrate == OV_FALSE )

       bitrate = 0;



   ov_clear (&vf);

   return 0;

}



This small sample may help, it reads bitrate and duration (copy / paste from tag)
john33
If you download a nightly snapshot of the CVS, or download via the CVS, you will acquire the current documentation which will provide you with all the information you require. If you go to vorbis.com, you can download via the links.
treech
ok guys, i'll take a look, thanks.
smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.