theora2jpeg

theora2jpeg.c :: gets a theora http stream and outputs a jpeg image every 5 frames for example to do a preview in a web browser

download ::http://www.artefacte.org/software/theora2jpg-0.11.tar.gz

you need ::
* libtheora-1.0alpha4
* libogg-1.1.1
* libvorbis-1.0.1

and also the cjpeg executable that is in the libjpeg-progs package.

compilation :: there is no makefile yet so just write

gcc -D_REENTRANT -o theora2jpg theora2jpg.c /usr/local/lib/libtheora.a -ldl -lpthread /usr/lib/libvorbis.so -L/usr/lib -lm /usr/lib/libogg.so

and cross your fingers ;)

how it works :: the code is borowed from the player_example that is in the theora library. I added some functions to access http streams and removed all the SDL and audiodev stuff cause is not needded here. Also added a yuv2rgb function that creates a ppm image file in the /tmp directory every 5 frames. Finally there is a call to the "system" function that executes the "cjpeg" program that converts the ppm image to jpg.

Usage :: theora2jpg http://server:port/file.ogg output-file

animation using PHP server-push

in the hteora2jpeg package you have a php script "preview.php" that creates a multipart MIME animation that can be viewed in mozilla browsers
to know about how it works visit the Netscape's page on server-push.

Requirements Works with Apache-1.3.14/PHP4.0.3pl1 server and mozilla compatible browsers.

Usage just edit the file and change the jpg image location. then call the acript in a html file like a normal imge with the IMG tag. <IMG SRC="preview.php">