|
|
| TopPage > swftoolsを使ってみる |
| Contents |
| インストール |
| version | License |
| swftools-0.9.0 | GPL v2 |
| swftools-0.8.1 | GPL v2 |
[hoge]#yum install swftools .... |
| コマンド |
| font2swf | (TTF,Type1)のfont fileをswfにコンバートする |
| gif2swf | gif fileをswfにコンバート.animation gifも可能. |
| png2swf | png fileをswfにコンバート. |
| jpeg2swf | jpeg fileをswfにコンバート. |
| pdf2swf | pdfをページ毎をフレーム毎のswfにコンバート |
| wav2swf | WAV audio fileをswfにコンバート |
| swfcombine | swf内に 別のswfをWrapperする. |
| swfbbox | SWF bounding boxの最適化を行う. |
| swfc | sc file formatのscript fileからswfを生成する. |
| swfextract | SWF fileからMovieClip,Sounds,Image等を抽出. |
| swfstrings | SWF内のテキストデータをスキャンする. |
| swfdump | swf file内images/fonts/sounds等の情報を出力. |
| swfファイルのHTMLへの埋め込み |
....
<object width="WWW" height="HHH"
classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">
<param name="movie" value="MyFlash.swf">
<param name="loop" value="T/F">
<param name="play" value="T/F">
<param name="bgcolor" value="#xxxxxx">
<embed src="MyFlash.swf"
width="WWW" height="HHH"
loop="T/F"
play="T/F"
bgcolor="#xxxxxx"
type="application/x-shockwave-flash"></embed>
</object>
....
|
| object: classid |
対象のオブジェクトを再生する方法を指定 "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" とした場合は、Flash Playerになる |
| object:codebase |
classidで参照するURLのpathを指定 ここの意味はよくわからない。。。 |
| embed :type | MIMEタイプの指定 |
|
object:movie embed : src |
ファイル名を指定 |
| loop |
繰り返し再生をするかどうかを指定 true :繰り返し再生する false:1度だけ再生 省略時は、true |
| play |
自動再生するかどうかの指定 true :自動再生 false:手動再生 省略時は、true |
| bgcolor |
バックグラウンドカラーを指定 #xxxxxxのところに#000000(黒)〜#FFFFFF(白)を記述 省略時は、#000000のようだ |
| width | 幅の指定 |
| height | 高さを指定 |
.... <object width="WWW" height="HHH"> <param name="movie" value="MyFlash.swf"> <embed src="MyFlash.swf" width="WWW" height="HHH"></embed> </object> .... |
| swfcで使えるカラー名称 |
|
|
|
| swfcで使えるコマンド |
| command | value & default | description |
| .flash |
bbox={autocrop/xmaxxymax/xmaxcxymax:xmin/xmaxxymax:xmin:ymin} background={black/another color name/#num} version={6/Num} fps={50/frame rate num} name= filename= @compress={default/yes/no/compress} @change-sets-all={no/yes} @export={1/Num} |
出力するswfファイルの指定 |
| .frame | n=+1 name= @cut=no @anchor=no | |
| .swf | name filename | |
| .shape | name filename | |
| .jpeg | name filename quality=80% | |
| .png | name filename | |
| .movie | name filename | |
| .sound | name filename | |
| .font | name filename glyphs= | |
| .soundtrack | filename | |
| .quicktime | url | |
| .define | name value=0 | |
| .point | name x=0 y=0 | |
| .gradient |
name @radial=0 rotate=0 scale= scalex= scaley= x= y= width= height= r= shear= |
|
| .interpolation |
name function=linear speed=1.3 amplitude=0 bounces=2 growth=1.5 damping=2 slope=0 |
|
| .outline | name format=simple | |
| .textshape | name font size=100% text | |
| .blur | name blur= blurx= blury= passes=1 | |
| .gradientglow |
name gradient blur= blurx= blury= angle=0.0 distance=0.0 strength=1.0 @innershadow=0 @knockout=0 @composite=0 @ontop=0 passes=1 |
|
| .dropshadow |
name color blur= blurx= blury= angle=0.0 distance=0.0 strength=1.0 @innershadow=0 @knockout=0 @composite=0 passes=1 |
|
| .bevel |
name shadow highlight blur= blurx= blury= angle=0.0 distance=0.0 strength=1.0 @innershadow=0 @knockout=0 @composite=0 @ontop=0 passes=1 |
|
| .box | name width height color=white line=1 @fill=none | |
| .circle | name r color=white line=1 @fill=none | |
| .filled | name outline color=white line=1 @fill=none | |
| .egon | name vertices color=white line=1 @fill=none | |
| .text | name text font size=100% color=white text= | |
| .edittext |
name font= size=100% width= height= text="" color=white maxlength=0 variable="" @password=0 @wordwrap=0 @multiline=0 @html=0 @noselect=0 @readonly=0 @border=0 ※borderをセットすると 外周:Black、バックグラウンド:whiteのbox表示になる @autosize=0 align={left/right/center/justify} |
編集可能なText |
| .morphshape | name start end | |
| .button | name | |
| .show |
name x=0 y=0 red=+0 green=+0 blue=+0 alpha=+0 luminance= scale= scalex= scaley= blend= filter= pivot= pin= shear= rotate= ratio= above= below= as= |
|
| .on_press | position=inside | |
| .on_release | position=anywhere | |
| .on_move_in | state=not_pressed | |
| .on_move_out | state=not_pressed | |
| .on_key | key=any | |
| .play | name loop=0 @nomultiple=0 | |
| .stop | name= | |
| .nextframe | name | |
| .previousframe | name | |
| .put |
name x=0 y=0 red=+0 green=+0 blue=+0 alpha=+0 luminance= scale= scalex= scaley= blend= filter= pivot= pin= shear= rotate= ratio= above= below= |
|
| .startclip |
name x=0 y=0 red=+0 green=+0 blue=+0 alpha=+0 luminance= scale= scalex= scaley= blend= filter= pivot= pin= shear= rotate= ratio= above= below= |
|
| .move | name x= y= interpolation=linear | |
| .smove | name x= y= interpolation=linear | |
| .sweep | name x= y= r= dir=counterclockwise arc=short interpolation=linear | |
| .change |
name x= y= red= green= blue= alpha= luminance= scale= scalex= scaley= blend= filter= pivot= pin= shear= rotate= ratio= above= below= interpolation=linear |
|
| .schange |
name red= green= blue= alpha= luminance= scale= scalex= scaley= blend= filter= pivot= pin= shear= rotate= ratio= above= below= interpolation=linear |
|
| .jump |
name x= y= red= green= blue= alpha= luminance= scale= scalex= scaley= blend= filter= pivot= pin= shear= rotate= ratio= above= below= |
|
| .del | name | |
| .texture | name x=0 y=0 width= height= scale= scalex= scaley= r= shear= rotate= | |
| .toggle | name fixed_alignment= | |
| .sprite | name scalinggrid= | |
| .action | filename= | |
| .initaction | name filename= | |
| .end |
| 練習1 |
.flash filename="exsample_box.swf"
.box b1 360 120 color=red fill=green
.box b2 320 100 color=blue fill=yellow
.put b1 pin=center scale=0%
.put b2 x=0 y=0 scale=100%
.frame 60
.change b1 pin=center scale=100%
.change b2 x=0 y=0 scale=0%
.frame 240
.change b1 pin=center scale=0%
.change b2 x=0 y=0 scale=100%
.frame 280
.change b2 x=0 y=0 scale=60%
.end
|
[host]$swfc exsample_box1.sc |
.... <object width="360" height="120"> <param name="movie" value="exsample_box.swf"> <embed src="exsample_box.swf" width="360" height="120"></embed> </object> .... |
| 文字を使用するためのフォントswfの生成 |
[host]$font2swf DejaVuLGCSans.ttf.ttf -o DejaVuLGCSans.ttf.swf [host]$font2swf DejaVuLGCSerif.ttf -o DejaVuLGCSerif.swf [host]$font2swf sazanami-gothic.ttf -o sazanami-gothic.swf [host]$font2swf sazanami-mincho.ttf -o sazanami-mincho.swf [host]$ll DejaVuLGCSans.swf DejaVuLGCSerif.swf sazanami-gothic.swf sazanami-mincho.swf DejaVuLGCSans.ttf DejaVuLGCSerif.ttf sazanami-gothic.ttf sazanami-mincho.ttf |
| file name | file size[Kbyte] | file name | file size[Kbyte] |
| DejaVuLGCSans.ttf | 436 | DejaVuLGCSans.swf | 373 |
| DejaVuLGCSerif.ttf | 207 | DejaVuLGCSerif.swf | 227 |
| sazanami-gothic.ttf | 7374 | sazanami-gothic.swf | 3271 |
| sazanami-mincho.ttf | 10171 | sazanami-mincho.swf | 5250 |
.flash filename="exsample_font.swf"
.font Sans "DejaVuLGCSans.swf"
.font Serif "DejaVuLGCSerif.swf"
.font Sgothic "sazanami-gothic.swf"
.font Smincho "sazanami-mincho.swf"
.text helloworldSans font=Sans text="Hello World! Sans"
.text helloworldSerif font=Serif text="Hello World! Serif"
.text helloworldSgothic font=Sgothic text="Hello World! sazanami-gothic"
.text helloworldSmincho font=Smincho text="Hello World! sazanami-mincho"
.text helloworldSgothicJ font=Sgothic text="ちわっ 世界! sazanami-gothic"
.text helloworldSminchoJ font=Smincho text="ちわっ 世界! sazanami-mincho"
.put helloworldSans x=0 y=0
.put helloworldSerif x=0 y=60
.put helloworldSgothic x=0 y=120
.put helloworldSmincho x=0 y=180
.put helloworldSgothicJ x=0 y=240
.put helloworldSminchoJ x=0 y=300
.end
|
[host]$swfc exsample_font1.sc |
.... <object width="360" height="200"> <param name="movie" value="exsample_font.swf"> <embed src="exsample_font.swf" width="360" height="200"></embed> </object> .... |

| 動画ファイルの情報を取得する(ffmpeg) |
[hoge]$ ffmpeg -i filename FFmpeg version ..... ..... Input #0, XXX, from 'filename': Duration:..... ..... At least one output file must be specified |
| AVIをSWFに変換する(ffmpeg,mencoder) |
[hoge]$ ffmpeg -i source_movie.avi -r 25 -b 512k -ar 22050 create_movie.swf |
[hoge]$ mencoder source_movie.avi -oac mp3lame -ovc lavc \ -lavcopts vcodec=flv:acodec=mp3:vbitrate=800:abitrate=224 -srate 22050 -ofps 25 -o create_movie.swf |
ffmpeg-0.5-2.el5.rf ffmpeg-devel-0.5-2.el5.rf ffmpeg-libpostproc-0.5-2.el5.rf |
Warning, using s16 intermediate sample format for resampling [libmp3lame @ 0xXXXXXX]lame: output buffer too small (buffer index: XXXX, free bytes: XXXX) |
[hoge]# rpm -Uvh --oldpackage --nodeps x264* .... [hoge]# rpm -Uvh --oldpackage --nodeps ffmpeg* .... |
[hoge]# yum update .... |
| TopPage > swftoolsを使ってみる |