I’ve spent most of today reacquainting myself with that most excellent of typesetting solutions, LaTeX. Microsoft Word is painfully inadequate at any serious document writing. I spend as much time fiddling with the formatting of my content as I do writing it. LaTeX, for the lay person, is like HTML and CSS: I declare all the formatting rules in my preface. I then write the article as I would a plain-text document (literally; I am using a plain-text editor), compile it to a PDF and enjoy my beautiful typesetting without clicking fiddly buttons or margins.
For reasons-reasons other than convenience-that I would not be able to fully articulate should you choose to put a gun to my head, I store my website’s files (WordPress), database and content images separately. I guess if one’s data centre is bombed then the other two will be okay?
Well, back to the convenience. I post a great many images to this blog; for the aforementioned convenience, I store my images in Dropbox. I can quickly and easily move, rename or alter images on my blog without having to piss about with FTP. Now, beyond handling the core image processing I don’t want to get bogged down in resizing, foldering, renaming and uploading all of those files. Because of this I script the action, but my current script only creates preview and thumbnail sizes:
mkdir -p $MED $SML
for file in $(find . -iname "*.jpg")
cp $file $MED
cp $file $SML
Move the given folder into my ~/Dropbox/public/content folder.
Construct the URL code I use and ready it for pasting. Typical code is below:
<a title="Click to view larger size" href="http://dl.dropbox.com/u/4144919/content/1466601748/1.jpg"><img src="http://dl.dropbox.com/u/4144919/content/1466601748/1.jpg" alt="" /></a>
For both steps, I need the ability to output only the name of the current directory I am working in, since this directory will be named according the number to the post. In the case of this blog post the folder name will be 1466601748. I spent about three hours fucking about with awk, sed, Google and pipes before I discovered a very simple one-liner that delivers the folder name unto me:
#2, generating the URL code, will be interesting, although trivial too. It seems like the easiest way is to echo the URL while I insert the post number and then stick the hot, steaming result into my clipboard. This works fine…but my sense of neatness is screaming at me that there is probably a more elegant way to achieve my goal:
I’ve been playing with my scrot relentlessly for the past two or three days. Literally non-stop for hours a time. I’ve even been making videos and then putting those videos on YouTube.
Scrot – SCReen shOT – is a FOSS screen capture utility that cleaves to the old Unix philosophy: It does one thing and does it very well indeed. And that is take screenshots. So get your freaking mind out of the gutter, dear reader(s).
It’s cool, I can wait.
Scrot is something I’ve used for my screen capturing since 2003 or so, and while I’ve previously bowed to scrot’s scripting prowess, it has only been in the last four days that I’ve discovered another fun use for scrot: Simple, lite (resource-wise) time-lapse capture of my desktop. You can do it at home with just scrot and mplayer.
Get scrot and mplayer on your system if you don’t already have them. Under Ubuntu, conveniently, it is:
apt-get install scrot mplayer
Type or copy and paste this command into the terminal while in the folder where you would like to capture the images
while [ 1 ]; do scrot -q 100 $(date +%Y%m%d%H%M%S).jpg; sleep 1; done
gives you an unending loop. Scrot will literally loop taking screensots until you finally decide to kill the program. As a quick rule of thumb, you need between 900 and 1,200 still images per minute of footage (60 seconds@15 FPS=900; 60 seconds@20 FPS=1,200). This does seem like a whole lot of still images, but at ~300 stills per 10 minutes, you’ll generate (300x6) 1,800 per hour.
So about two hours of recording will net you a video that will go along very nicely to your average song track.
Make a list for mencoder to read:
ls -1tr *.jpg > files.txt
Stitch together your still images with mencoder. While I noted my own preferences aloud yesterday, you really are free to look at mencoder’s options – and I freely encourage you to do this. So far as I can gather, mencoder can do anything you ask of it…if you know the correct account.
Encoding your video as-is (video raw, like still raw) is great for quality, but takes up a respectable chunk of hard-disk space. I settled on encoding with h.264 because it gave me a great balance of file-size and quality. Your frames per second in the video matter for two reasons: 1. Controlling video length (for fitting it to a soundtrack), and 2. controlling playback speed. Do you want events to whizz past, or be slower and more followable?