imovie

下载安装code swarm,系统环境预备见 https://github.com/rictic/code_swarm

1 git clone git://github.com/rictic/code_swarm.git && cd code_swarm # 下载源码
2 ant # 编译

合并多个git仓库

 1 mkdir eoecn_codebang && cd eoecn_codebang # 创建临时仓库目录,并切换
 2 git init && git commit --allow-empty-message -am '' --allow-empty # 初始化git环境
 3 git remote add programmingonline git@eoe.git.server:/opt/datas/git/eoe/programming.online.git # 添加多个git仓库
 4 git remote add eoecn git@eoe.git.server:/opt/datas/git/eoe/eoecn.git
 5 git pull programmingonline master # 合并多个git仓库
 6 git pull eoecn master
 7 git commit -am 'merge programmingonline and eoecn' # 直接合并冲突
 8 export PATH="/Users/mvj3/github/rictic/code_swarm/bin:$PATH" # 把code_swarm的bin目录加入到环境变
 9 量中
10 code_swarm # 不用管他出错提示,只要在运行就可以了。它会在当前目录下生成包含git历史记录信息的.code_swarm/log.xml
11 ruby -e 'filename = "/Users/mvj3/eoemobile/code/eoecn_codebang/.code_swarm/log.xml"; File.write(filename, File.read(filename).gsub(/@[^"]*\"/,"\""))' # 在ruby里把无效的email后缀去除。

生成一帧一帧的png文件

1 pwd   #  先切换回code_swarm项目目录,修改defaults/user.config里的InputFile变量到刚才生成的.code_swarm/log.xml的绝对路径
2 ./run.sh defaults/user.config # 如果没错误的话,你就可以frames目录下不断有png生成了。如果量大的话,你会听到电脑的风扇也在狂转了。

用iMovie制作视频

1 ffmpeg -f image2 -r 12 -i ./frames/code_swarm-%05d.png -sameq ./out.mov -pass 2 # 用ffmpeg生成视频,直接iMovie导入这么多png太慢

iMovie使用总结

任何视频,音频,字幕操作都是选中后操作,包括时长,大小,变速等。

参考文档

  • http://code.google.com/p/codeswarm/wiki/GeneratingAVideo#Instructions_for_running_Codeswarm_0.1_on_OS_X_10.6_with_a_git_r
  • http://progressdaily.diandian.com/post/2012-01-20/14242590

附上配置文件 user.config

  1 # Your personal preferences for code_swarm, applied to every visualization
  2 # you run, unless overridden by the individual visualization's config
  3 
  4 #DON'T EDIT THIS FILE IN PLACE, FIRST COPY IT TO defaults/user.config
  5 #CHANGES TO THIS FILE WON'T BE SEEN BY code_swarm, ONLY user.config
  6 
  7 #Some common options to customize:
  8 
  9 # It's much faster if we can use OpenGL, but it still doesn't work on some
 10 # platforms/configurations
 11 UseOpenGL=true
 12 
 13 # The size of the visualization window
 14 Width=640
 15 Height=280
 16 
 17 Font=Helvetica
 18 FontSize=25
 19 BoldFontSize=20
 20 TakeSnapshots=true
 21 
 22 #Size in pixels of the width and height of avatar images
 23 AvatarSize=64
 24 
 25 InputFile=/Users/mvj3/eoemobile/code/eoecn_codebang/.code_swarm/log.xml
 26 SnapshotLocation=frames/code_swarm-#####.png
 27 #For more options, see defaults/code_swarm.config
 28 
 29 
 30 
 31 # Draw names (combinatory) :
 32 # Draw sharp names?
 33 DrawNamesSharp=true
 34 # And draw a glow around names? (Runs slower)
 35 DrawNamesHalos=false
 36 
 37 # Draw files (combinatory) :
 38 # Draw sharp files
 39 DrawFilesSharp=false
 40 # Draw fuzzy files
 41 DrawFilesFuzzy=true
 42 # Draw jelly files
 43 DrawFilesJelly=false
 44 
 45 # Show the Legend at start
 46 ShowLegend=false
 47 
 48 # Show the History at start
 49 ShowHistory=true
 50 
 51 # Show the Date at start
 52 ShowDate=true
 53 
 54 # Show edges between authors and files, mostly for debug purpose
 55 ShowEdges=false
 56 
 57 # Turn on Debug counts.
 58 ShowDebug=false
 59 
 60 # Natural distance of files to people
 61 EdgeLength=25
 62 
 63 # Amount of life to decrement
 64 EdgeDecrement=-2
 65 FileDecrement=-2
 66 PersonDecrement=-1
 67 
 68 #Speeds.
 69 #Optional: NodeSpeed=7.0, If used, FileSpeed and PersonSpeed need not be set.
 70 #
 71 FileSpeed=7.0
 72 PersonSpeed=2.0
 73 
 74 #Masses
 75 FileMass=1.0
 76 PersonMass=10.0
 77 
 78 # Life of an Edge
 79 EdgeLife=250
 80 
 81 # Life of a File
 82 FileLife=200
 83 
 84 # Life of a Person
 85 PersonLife=255
 86 
 87 # Highlight percent.
 88 # This is the amount of time that the person or
 89 # file will be highlighted.
 90 HighlightPct=5
 91 
 92 ## Physics engine selection and configuration
 93 # Directory physics engine config files reside in.
 94 PhysicsEngineConfigDir=physics_engine
 95 # Force calculation algorithms ("PhysicsEngineLegacy", "PhysicsEngineSimple"...) :
 96 PhysicsEngineSelection=PhysicsEngineOrderly
 97 
 98 #Is the input xml sorted by date?  It's faster and uses much less memory if it is
 99 IsInputSorted=true
100 
101 # OpenGL is experimental. Use at your own risk.
102 UseOpenGL=false
103 ShowUserName=true