Posts

Showing posts from November, 2011

Using ffmpeg to manipulate audio and video files

Image
INTRODUCTION I recently became curious about converting between video formats, wondering if there was anything I could do to reduce the size of the various .mpg, .flv, .avi and .mov files that I have lying around. I also wondered if it would be possible to convert some of these files to the .3gp format used by 3G cellphones, and if it would be possible to rip a DVD-Video to DivX. Finally, I wanted to know if I could rip DVDs of concerts and operas that I have and listen to them on my MP3 player. Best of all would be the ability to do all of this with a single tool.

Batch resize photos

One of the things I like best about linux is that there exists a one-liner that would take ages to complete using free programs. Commercially available programs does certainly do but, they are commercial! . When you take pictures with your camera, smartphone or whatever, you will have files of at least 1-2 MB. When you take a lot of them, and want to upload them to web albums (e.g., Picasa web, or Flickr) then you would have trouble uploading all of them. For web viewing, resizing them is a great idea. To quickly resize all the pictures, use the following (ImageMagick has to be installed to be able to do this): mogrify -resize 640 *.jpg

Batch rename files

When renaming a number of files at the same time, it is more convenient to use a GUI for the job. Métamorphose is one such program that does the job brillianty, and freely. There are others Flash Renamer was another (not free) great program. However, sometimes it is fun to do the same stuff using command-line. Below are a couple of ways to do batch renaming.

Securely delete files in a harddisk

The following command will erase files in the entire disk. So be careful when using this. I once accidentally erased a partition other than the one I intended. Make sure the sd# is correct. shred -vfz -n 10 /dev/sd# /dev/sd# is the entire harddisk. -n 10 refer to the passes the entire harddisk is overwritten with zeros (-z). -f tells shred to force the write by changing the permissions wherever necessary.

Apple Keyboard on PC - Getting the keys to work

Enabling Buttons on Apple Keyboard in Windows apple-keyboard I recently picked up, and am liking, the new “wafer thin” aluminum keyboard from Apple. Its very small, I like the key action and it’s very solid considering it’s size and thickness. But, I use it on Windows, and there’s no driver available other than the standard keyboard one, so the extra keys like media controls aren’t enabled. I came across a freeware macro program called AutoHotKey that works very nicely, and wrote up a few little scripts for it. You can download AutoHotKey and run the scripts yourself, or you can download the compiled version here [enable_mac_aluminum.zip, 193KB] and just pop it into your Startup folder.