- Basic command line knowledge.
- Xcode. If you're running lion, you can download version 4 for free from the 'App Store'. If you're running an earlier version, it should be included on your OS X installation disc.
Getting FFmpeg
First we'll have to download MacPorts. This is a project that lets you download, compile and install a lot of Linux tools easily. Get your MacPorts installation file here. Open the DMG and install the MacPorts package.
Next fire up a terminal and enter these commands:
sudo port -v selfupdate
sudo port install ffmpeg
That last one could take a lot of time, so be patient.
b3n's Screenshot Script
Next, save the following code to a textfile called screenshot.sh.
"b3n's Screenshot Script" wrote:
#!/bin/bash
file=$1
times=$2
x=1
while [ $x -le $times ];
do
ffmpeg -ss $(echo "$x * 1200" | bc -l) -i "$file" -an -vframes 1 -f image2 images$(echo "$x").png;
x=$(( $x 1 ))
done
Switch back to the terminal, change to the directory where you saved screenshot.sh and make the file executable with following line:
chmod +x screenshot.sh
This script will extract a screenshot every 20 mins as many times as you specify. The first argument is the file you want to take screenshots of, the second is how many screenshots you want. Example usage if you want to take 4 screenshots of example.mkv:
./screenshot.sh example.mkv 4
Add An Alias (Optional)
In the terminal, enter:
cd
open .bash/profile
This should open a texteditor window. Add a new line in this file like this:
alias screenshot='/path/to/screenshot.sh'
But replace /path/to/screenshot.sh with your actual path to the screenshot script. Leave the quotes. Save and exit. Now you can invoke the script from anywhere without giving the full path like this:
screenshot movie.mkv 4
0 comments:
Post a Comment