此为译稿,原始来源: http://www.carbonsilk.com/development/timelapse-video-mac/
更多类似应用: http://lancewig.com/2008/08/06/tutorial-poor-mans-macbook-webcam/
Me on a time lapse from James Broad on Vimeo.
你可以在 Mac 上跟随以下步骤来创建上面类似的视频。
步骤 1
下载并安装一个命令行下拍照的工具:isightcapture
http://www.macupdate.com/info.
打开这个 dmg 并复制 isightcapture 到/usr/bin/
sudo cp /Volumes/isightcapture1_1/isightcapture /usr/bin/
步骤 2
创建一个目录来保存我们的视频和图片,假设为 ~/captures/ 。
cd ~ mkdir captures mkdir captures/scripts mkdir captures/series
步骤 3
创建一个脚本,用于捕捉并保存图片:
cd ~/captures/scripts vim captureme.sh
输入以下内容:
CAPTURE="isightcapture -t jpg" cd $HOME/captures D1=`date +%y%m%d/%H` D2=`date +%y%m%d.%H%M%S` # If the date directory does not exist, create it if [ ! -d $D1 ] ; then mkdir -p $D1 fi # Construct the filename and path and capture a pic FN="$D1/$D2.jpg" $CAPTURE $FN # Make a symlinked image of the last photo taken if [ -h 'last.jpg' ] ; then rm last.jpg fi ln -s $FN last.jpg
保存并退出(:wq)
给这个脚本添加执行权限
chmod a+x captureme.sh
步骤 4
把这个脚本变成自动运行的:
crontab -e
然后这么写:
* * * * * ~/captures/scripts/captureme.sh
保存,退出(:wq)
步骤 5
做到以上步骤,你的电脑已经每分钟拍一张照片,并且保存到 ~/captures/年月日 目录下了。 下面是把那些图片连起来做成视频,你可以用自己的方式来乐(因为装这个 ffmpeg 很麻烦)。 我想后面的属于高级主题,就不翻译了,大家自己搞定吧 :)。
Install a utility to convert a series of images to a movie. We will be using ffmpeg
cd /tmp/
svn checkout svn://svn.ffmpeg.org/ffmpeg/
cd ffmpeg
We need to install ffmpeg to our machine, this process is going to basically compile the code. Hopefully nothing will go wrong for you here, if it does though, take a look on http://stephenjungels.com/
./configure --enable-shared --disable-mmx
sudo make
sudo make install
Step 5
Make script to grab photos and run them through ffmpeg
mkdir ~/captures/videos/
cd ~/captures/scripts
vi make_complete_sequence.sh
Write the contents to the file:
COUNTER=0; rm ~/captures/series/*.jpg for i in `find ~/captures -name '*.jpg'` ; do #Write the filename to be friendly with ffmpeg's odd filename input FILENAME=`printf '%03d.jpg' $COUNTER` cp $i ~/captures/series/$FILENAME let COUNTER=COUNTER+1; done nice ffmpeg -r 20 -b 1800 -i ~/captures/series/%3d.jpg ~/captures/videos/timelapse_complete.mp4
Again setting the permissions to be able to run the script and then run it to generate a movie based on the images taken so far.
chmod a+x make_complete_sequence.sh
./make_complete_sequence.sh
Step 6
View the finished result Browse in finder to your home directory > captures/videos and watch the result.
1 comment:
白搭.......没来得及买镜头来......
Post a Comment