From: Stefan v. d. W. <st...@su...> - 2005-03-01 14:34:31
|
Hi all The attached code allows octave to generate AVI (video) files. I used ffmpeg's libavcodec -- one of the few available GPL/LGPL packages around. To compile this you'll need a recent version of ffmpeg. Under Debian, install the 'ffmpeg', 'libavformat-dev' and 'libavcodec-dev' packages. Under RPM-based systems 'ffmpeg' and 'libffmpeg0-devel' should suffice. The following code demonstrates avifile's usage: #---------------------------- # create the avifile object m = avifile("test.avi", "msmpegv4") # make a hundred frames for i = 1:100 I = zeros(100,100,3); # draw something in the frame -- in this case, a sine-wave # with changing phase for x = 1:100 I(round(50+10*sin((x+i)/100*4*pi)), x, 1) = 40; # red I(round(50+10*sin((x+i)/100*4*pi)), x, 2) = 40; # green I(round(50+10*sin((x+i)/100*4*pi)), x, 3) = 180; # blue endfor # add the frame to the movie addframe(m, I) printf(".") endfor # close the file and write headers clear m #---------------------------- To get a list of codecs, do avifile("codecs") The code is still beta. Especially, when generating two videos in one octave session, the second video seems to be broken. At the moment, only write support is implemented. Any feedback/fixes appreciated. Regards Stefan |