2010年7月26日星期一

用 ffmpeg 將一大串相片連成一條影片

用 ffmpeg 將一大串相片連成一條影片

今日用左timer set 2 second 拍一大串相片
filename 由 DSC04391.JPG 去到 DSC04729.JPG

上網search 到既方法
http://electron.mit.edu/~gsteele/ffmpeg/

所以要準備ffmpeg

第一部.
download Mac OSX 10.6 用既ffmpeg
發覺好似無standalone binary download
所以用左下面既方法去抄個 ffmpeg standalone binary execute 出來
First, download ffmpegx, which contains ffmpeg from http://ffmpegx.com/download.html

Then, mount the .dmg file, navigate to the mounted disk, and control-click on the ffmpegX application (ffmpegX.app), choose Show Package Contents from the pop-up menu, and copy the ffmpeg binary to, for example, /tmp.

http://snippets.aktagon.com/snippets/132-How-to-install-ffmpeg-mencoder-and-flvtool2-on-Mac-OSX-Leopard-convert-an-AVI-to-FLV-and-view-the-FLV-video-with-FlowPlayer

第二部.

因為ffmpeg 只支援順序 filename
由001.jpg 至 015.jpg
所以要batch rename d 相 filename

上網一search 發現 Mac OSX 可以用Automator 自動更改順序 filename
Now you can chose how you'd like to rename your files. This method, of course, does not let you include the episode name in the file, so what I do is that I include a nfo-file with the thetvdb.com-url for that show in the show in the root folder of the show, and then I rename my files like this:

1. Chose "Make Sequential" in the drop down menu
2. Click on "new name" and write the name of the show followed by a space and S01E * S02 if the show is from the 2nd season etc.
3. Place numer: after name, Start numbers at: 1, separated by: nothing, and then just cross out "Make all numbers" 2 digits long.
http://www.networkedmediatank.com/showthread.php?tid=27394

第三部.
用 ffmpeg 將一大串相片連成一條影片
./ffmpeg -r 10 -b 1800 -i chip2/chip2-%04d.jpg -s 960x720 chip2_960720_1800_10.mp4
-r 10
10 fps
-b 1800
1800kbps
-i chip2/chip2-%04d.jpg
chip2-0001.jpg ~ chip2-0433.jpg
-s 960x720
output video size 960x720