DOS scripting, hell yeah! Posted by Swapnil Pathare on Jun 13

Woo, so to convert all my video files to FLV, I had decided to use ffmpeg. The issue was that all this was happening on a Windows PC. I faced the grim reality:

I need to recursively span directories and pass all movie files to ffmpeg

Pretty simple really… as a Perl or bash script… people could vote me off the Internet for posting such a silly event in a tech blog. But as I mentioned earlier, I was on Windows. Without Perl.

These are deep waters, Jeeves

-Bertram Wooster to Jeeves in “Very Good, Jeeves!”

Fortunately for me, a command to parse directories for specific file extensions is available in DOS. God is great, and so is Microsoft, sometimes.

So here goes,

for /R %A in ("*.avi" "*.mpg" ") do ffmpeg <options> -i %A %A.flv

With the power of for command (lots of switches and options available) and its combination with if command to prune the results, I see a lot of stuff that can be done right here in MS Dos. Not that I’d be keen to do it, but if time comes, Google and DOS won’t be a bad deal, I believe.

ffmpeg rocks! Posted by Swapnil Pathare on Jun 13

I was stuck with a quite a lot of avi, mpg, asf, mov files imported from cameras across the family with their own encoding styles. How do I make them easily available over the web without posting them to youtube was the question. I have flvplayer, integrated in zenphoto (I love zenphoto), which can play .flv files comfortably.

Fortunately, the open source tool ffmpeg came handy. The tool itself is rock stable and there are dozens of projects using this tool internally. It was a bit of a task understanding which of the thousands of switches to use in order to get that perfect conversion, but Taka flv encoder helped me out in that. Its so useful when a software provides us the internal command that it will use to complete the task which you have configured through GUI. Awesome.

Taka flv encoder itself wasn’t good for converting more than one file at a time. So instead of searching for batch file conversion GUI software, I just passed the bulk of files to ffmpeg. It had taken care of all videos in a couple of hours. Capable of converting most video formats heard by humans. So much for issues in free software!

HTTP Login for Websites Posted by Swapnil Pathare on Jun 12

I don’t really have a problem with https the way it is, but I believe a lot of money is already going to the security certification authorities (CAs).

So for websites which aren’t too keen to avoid the man-in-the-middle attack, an https login with a self-signed certificate is good enough. This is quite decent for websites with low, local user base, where not really much is at stake. Or internal websites of companies, meant for employee access through LAN. Anyway with a good monitoring system, a malicious user can be caught much more easily in a LAN as compared to fishing for one on the Internet.

However, an http login can also be sufficient, especially for webapps which encrypt only user password and provide remaining pages of the application unencrypted. This login method is foolproof against replay attacks as well. The protocol used is CHAP.

I’d explain it, but instead of being my usual vague self, I’ll just redirect you to Paj’s page where he elaborates on this method beautifully.

Code in JSP and Javascript (js library from Paj’s site) is available here

Next Entries »