Coherent Blah's

Samya DasSarma: November 2008 Archives

Converting Video/Audio on Linux is a breeze, and there is no shortage of tools. Especially between ffmpeg and mencoder, I can't think of any conversion that's not possible.
However, the problem is finding the right parameters suited for a specific task. There are multiple "wrapper" tools (e.g. Avidemux, HandBrake) that make life a lot easier. However, sometimes, knowing the actual conversion parameters help.

I was trying to convert some videos so that they play on Windows without need for any extra codecs etc. WMV format is the way to go for this. The following ffmpeg recipe seems to be working fine:

ffmpeg -i <input_file_name>  -s <output_resolution> -b <video_bitrate> -vcodec wmv2 -acodec wmav2 -ar 44100 -ab <audio_bitrate> -ac 1 -y <output.wmv>


Example:
ffmpeg -i output.avi  -s 180x120 -b 300k -vcodec wmv2 -acodec wmav2 -ar 44100 -ab 48000 -ac 1 -y movie.wmv

  Recently I was playing with couple of link scraping libraries, and was impressed by the simplicity of the mechanize toolkit. The only problem they have is lack of documentation.
  Following is an example script written in python that can do a google search and scrape the result links (of class ‘l’) in a few lines of code.

import re
import sys
from mechanize import Browser,DefaultFactory
import mechanize;

br = mechanize.Browser( factory=DefaultFactory(iwantbrokenxhtmlsupport=True))
br.addheaders = [ (“User-agent”, “Mozilla/5.0 (compatible)”) ]
br.sethandlerobots(False)

br.open(‘http://www.google.com/search?q=’+sys.argv[1])

def arrtonamed(arr):
        ret = {};
        for x in arr:
                ret[x[0]] = x[1];
        return ret;
# follow second link with element text matching regular expression
for link in br.links():
    hash = arrtonamed(link.attrs);
    if hash.has_key(‘class’):
            if (hash[‘class’] == ‘l’):
                print link.url+’[‘+link.text+’]’


A sample output for the script is:

$ python goog.py samya
http://www.thinkbabynames.com/meaning/0/Samya[Samya - meaning of Samya name]
http://www.samyatech.com/[SAMYA Technology : Green Power Expert! 祥業科技股份有限公司: 綠色 ...]
http://www.yawiktionary.com/s/1148371572412.html[samya - definition of samya - yawiktionary.com]
http://samya.indiangeek.com/[[ IndianGeek ] Welcome to Samya's HomePage]
http://www.hossamramzy.com/stars/starsofegypt_samya.htm[The Stars of Egypt ® | Hossam Ramzy]
http://www.belly-dance.org/samia-gamal.html[Samya Gamaal - the queen of raqs sharki]
http://www.samya.ca/[Samya Therapies Splash Page]
http://samya-photography.deviantart.com/[Samya-Photography on deviantART]
http://www.facebook.com/people/Samya_Badraoui/1434855400[Samya Badraoui | Facebook]
http://www.healthgrades.com/directory_search/physician/profiles/dr-md-reports/Dr-Samya-Nasr-MD-EB461FD0.cfm[Dr. Samya Z. Nasr, MD, Pediatric Pulmonology, Pediatrics, located ...]


On my impending trip to India, I'm planning to move my family from using Windows to Linux. I have Kubuntu Intrepid Ibex in mind as the distro.
The primary applications for my parents are Email (Thunderbird) & Web browsing (Firefox), both of them work like charm on Linux.
However, my father being a writer, he needs an editor that allows him to write in bengali, a regional language. Now, there is of course the keyboard layouts available for writing in bengali, and generate unicode output, it's not that useful as it doesn't support phonetic input. So, the writer will have to remember the keyboard layout.
Then I found Bhasha, a Java stand-alone application that allows writing in bengali phonetically, and produces unicode output. Problem solved.
Here is a screenshot.

About this Archive

This page is a archive of recent entries written by Samya DasSarma in November 2008.

Samya DasSarma: September 2008 is the previous archive.

Find recent content on the main index or look in the archives to find all content.