After playing with the Ruby Ming extension a little more I found that they don’t have support for SWFVideoStreams so I made a patch to add it. The patch also fixes the beta issues I described in building the ming ruby extension.
Here are the steps you need to follow to patch and install the latest Ming Ruby extension:
- Download the 0.1.7 version from: wget http://rubyforge.org/frs/download.php/1841/ming-ruby-0.1.7.tar.gz
- Uncompress the archive file: tar xvzf ming-ruby-0.1.7.tar.gz
- Change into the source directory: cd ming-ruby-0.1.7
- Download the new SWFVideoStream file and stick it into the ext/ming/mingc directory: wget -O ext/ming/mingc/swfvideostream.c http://d28nuaxr58rcpu.cloudfront.net/mingruby/swfvideostream.c
- Download the patch: wget http://d28nuaxr58rcpu.cloudfront.net/mingruby/patch
- Apply the patch: patch -p0 -u < patch
- Run the setup script: ruby setup.rb
If you want the source and patch by themselves you can find get those from: swfvideostream.c and patch
And here is an example of using the SWFVideoStream to embed a Flash video into your Flash movie:
[code lang=”ruby”]
#!/usr/bin/env ruby
require ‘ming/ming’
include Ming
Ming::set_scale(10.0000000)
m = SWFMovie.new(7)
m.set_background(0xff, 0xff, 0xff)
m.set_dimension(320, 240)
m.set_rate(8)
vstream = SWFVideoStream.new(‘test.flv’)
vstream.set_dimension(320, 240)
m.add(vstream)
0.upto(vstream.get_num_frames) do
m.next_frame
end
m.save(“test.swf”)
[/code]
The above example assumes you have a Flash video file available named test.flv. If you don’t have one you can make one by reading about creating flash videos with FFMpeg.
[tags]ruby, ming, flash[/tags]
I cant do: Apply the patch: patch -p0 -u
when i run this (wget -O ext/ming/mingc/swfvideostream.c) command on command prompt it gives a error that wget is not recognized as a internal or external command why it gives