I'd like to get basic information about a Theora file using C# .NET. How can I get started on this? I know there's oggz-info and other utilities, but I'd like to do this straight from in .NET. What's the documentation page to find more on this? Can I just read the first x bytes of the video corresponding to each field? I found this page which I think is what I need, but I'm not sure. http://theora.org/doc/libtheora-1.1/group__decfuncs.html -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/theora/attachments/20091213/877edf41/attachment.htm
Silvia Pfeiffer
2009-Dec-30 08:23 UTC
[theora] Reading framerate, height, width from Theora file
Maybe the DirectShow filters can help you get started? http://svn.xiph.org/trunk/oggdsf/ Cheers, Silvia. On Mon, Dec 14, 2009 at 7:10 AM, G <w3stfa11 at gmail.com> wrote:> I'd like to get basic information about a Theora file using C# .NET. How can > I get started on this? > > I know there's oggz-info and other utilities, but I'd like to do this > straight from in .NET. What's the documentation page to find more on this? > Can I just read the first x bytes of the video corresponding to each field? > > I found this page which I think is what I need, but I'm not sure. > http://theora.org/doc/libtheora-1.1/group__decfuncs.html > > _______________________________________________ > theora mailing list > theora at xiph.org > http://lists.xiph.org/mailman/listinfo/theora > >
Ralph Giles
2009-Dec-31 00:06 UTC
[theora] Reading framerate, height, width from Theora file
2009/12/13 G <w3stfa11 at gmail.com>:> I'd like to get basic information about a Theora file using C# .NET. How can > I get started on this?You can just read the information out of the first few KB of bitstream, but it's a little complicated. The first packet of each theora stream has the framerate and picture dimensions, and the second has author/title metadata (if any has been set). See Figure 6.2 "Identification Header Packet" in http://theora.org/doc/Theora.pdf for the layout of the first header. The unscaled frame dimensions are the PICH and PICW fields, each stored in 24 bits starting at byte offset 14 and 17 from the start of the packet. The frame rate is stored as a rational number, with the numerator and denominator as two consecutive 32 bit integers starting at byte offset 22. This is followed by the pixel aspect ratio as two 24 bit integers; multiply the picture width by their ratio to get the display size, or multiply the ratio of the frame dimensions by the pixel aspect ratio to get the frame aspect ratio (e.g. 4:3 or 16:9). The theora data will be wrapped in a container though, so these data won't be at a fixed offset in the file. See http://xiph.org/ogg/doc/rfc3533.txt (or http://xiph.org/ogg/doc/oggstream.html and http://xiph.org/ogg/doc/framing.html) for how to parse and verify the Ogg container theora is usually stored in. If you just want something quick and dirty, search for the sequence 0x80,"theora" 28 bytes after the sequence 'OggS' somewhere in the first few KB of the file. the 0x80 is the start of the first theora packet. Hope that helps, -r