Generating ogg theora from individual frames
Hello World,
When I have absolutely nothing useful to do (which has been quite a while ago now), I sometimes like to play with povray. Not that I'm very good at it—I'm a programmer, not an artist—but it still is good fun.
What I usually prefer doing is creating an animation. This is rather easy with povray; you can have it modify certain values in your scene based on some "clock" variable, and then generate a series of different frames based on that one scene description. This creates a large number of image files in the format that you specified (say, .png) in your output directory.
Of course a number of frames is not an animation yet. If you want that, you need to do some postprocessing on these images. ImageMagick to the rescue.
convert foo*.png foo.mpg
This works, but I don't like the low quality which the MPEG2 format gives me; and it also requires me to install the non-DFSG-free and slightly buggy MPEG2 reference implementation before it'll work. That's not very nice.
What I'd really like is for something similar that will work with Ogg Theora. So, dear lazyweb, is something like that even possible? This would preferably not require me to know too much about Ogg Theora, but just take a bunch of files and output a .ogg file—much like the above convert command line.
Thanks,
here two ways you could do this, one is in the examples folder in libtheora, might be in libtheora-bin by now, thats png2theora, the other is ffmpeg2theora:
png2theora frame%06d.png -o output.ogg
ffmpeg2theora -f image2 frame%06d.png -o output.ogg
hi, what about ffmpeg2theora ?
http://v2v.cc/~j/ffmpeg2theora/ http://packages.debian.org/sid/ffmpeg2theora
Encode a series of images: ffmpeg2theora -f image2 frame%06d.png -o output.ogg
mencoder 'mf://*.png' -mf fps=25 [output options for mencoder]
should do it. Mencoder can't create theora by itself AFAIK, but you can probably pipe it together with a theora encoder in some way (I dunno how, but mencoder has a good, long man page), or just go with some mpeg4 format like h264 or xvid.
This will give you the files listed in a stream.yuv:
mplayer "mf://*png" -vo yuv4mpeg
You can then run:
ffmpeg2theora stream.yuv -o movie.ogg
and get an Ogg Theora video. There's probably a better way, but I just tested this and it works.
You can use mencoder to put the pngs into an intermediate movie format (possibly the lossless FFV1 codec if you want no compression artifacts and the movie is short), and then use ffmpeg2theora to convert that into ogg/theora.
Eg: mencoder 'mf://*.png' -mf fps=25:type=png -ovc lavc -lavcopts vcodec=ffv1 -o intermediate.avi
mencoder "mf://*.png" -mf fps= -o output.ogg -ovc lavc -lavcopts vcodec=libtheora
Speed is pictures/second. I'd start with 25 and adjust from there.
You could use ffmpeg for *.png input and fed it to theoraenc via pipe.
Example: ffmpeg -i image%03d.png -f yuv4mpegpipe -pix_fmt yuv420p - | theoraenc -o test.ogg -b 2000 -q 8 -
image%03d.png means files named from image000.png to image999.png
ffmpeg can encode to theora by it self, but for unknown reasons it did not work for me (output file was corrupt).
Hi,
maybe this helps:
gst-launch multifilesrc location=%05d.png \ caps="image/png,framerate=30/1,pixel-aspect-ratio=1/1" ! \ pngdec ! ffmpegcolorspace ! video/x-raw-yuv,format=\(fourcc\)I420 ! \ theoraenc ! oggmux ! filesink location=output.ogg
from (http://gstreamer.freedesktop.org/wiki/MultiFileSrc)