Nicolas R.
2008-Jun-18 14:27 UTC
[theora-dev] Simple decoder (keyframe only) implementation ?
Hello everybody ! I am working on a php class to enable, on the server-side, to extract useful data from Ogg theora videos. http://opensource.grisambre.net/ogg . I need to have it extract a thumbnail picture from a video (much like dailymotion or youtube). Right now, I am doing it using the ffmpeg-php extension (for picture extraction only), but the problem is that this module is available on very few php servers. I am (still) trying to make a very simple implementation, for INTRA frames only, using the official theora documentation and going step by step. But I am feeling like doing everything from scratch, like reinventing the wheel, with many difficulties due to my lack of knowledge on video coding. And most of the time I have difficulties understanding some particular point of the process, and the actual theora svn code source is very difficult to corelate with the theora documentation (not same vocabulary, names of variables, way of decoding...)... My question is: has anyone done any simple decoder, for a single keyframe, in any structured langage I could reuse the code (c, c++, php, python, perl, java, anything ?) Thank you very much in advance... Nicolas _________________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/theora-dev/attachments/20080618/1f28761a/attachment.htm
Timothy B. Terriberry
2008-Jun-18 14:42 UTC
[theora-dev] Simple decoder (keyframe only) implementation ?
Nicolas R. wrote:> My question is: has anyone done any simple decoder, for a single > keyframe, in any structured langage I could reuse the code (c, c++, php, > python, perl, java, anything ?)You may be interested in the Python decoder Dan B. Miller started working on: http://svn.xiph.org/trunk/theora-old/doc/python/ His plan was to use it as sort of a "self-documenting spec", but he never finished it. I believe he did get keyframe decoding working correctly, though, so it might be a useful starting point.
Hi Nicolas, You can use the ogg video tool ( http://dev.streamnik.de/oggvideotools.html ) stuff to do this. I think, the oggScroll tool would be a good starting point. Using the c++ api is quite easy: /* open a stream serializer */ StreamSerializer streamSerializer; streamSerializer.open(inputFile); /* create a theora decoder, packet and picture object */ TheoraDecoder theoraDecoder; OggPacket packet; TheoraVideoPacket picture; /* loop for grabbing the picture */ while (streamSerializer.available()) { /* get the next picture and it's time */ double time = streamSerializer.getNextPacket(packet); /* is this a keyframe */ if (TheoraDecoder::isPacketKeyframe(packet)) { theoraDecoder << packet; theoraDecoder >> picture; /* here you are on your own :-) */ /* you'll find a yuv_buffer within the picture object class */ } } Regards - Yorn Am Mittwoch 18 Juni 2008 16:27:51 schrieb Nicolas R.:> Hello everybody ! > > I am working on a php class to enable, on the server-side, to extract > useful data from Ogg theora videos. http://opensource.grisambre.net/ogg . > > I need to have it extract a thumbnail picture from a video (much like > dailymotion or youtube). Right now, I am doing it using the ffmpeg-php > extension (for picture extraction only), but the problem is that this > module is available on very few php servers. > > I am (still) trying to make a very simple implementation, for INTRA frames > only, using the official theora documentation and going step by step. But I > am feeling like doing everything from scratch, like reinventing the wheel, > with many difficulties due to my lack of knowledge on video coding. And > most of the time I have difficulties understanding some particular point of > the process, and the actual theora svn code source is very difficult to > corelate with the theora documentation (not same vocabulary, names of > variables, way of decoding...)... > > My question is: has anyone done any simple decoder, for a single keyframe, > in any structured langage I could reuse the code (c, c++, php, python, > perl, java, anything ?) > > Thank you very much in advance... > Nicolas > _________________________________________________________________