Posts

Showing posts from 2010

Merging and encrypting PDF with Ghostscript

Recently I needed to merge several PDF files into a single file and also encrypt it. So after some googling, here my recipe: gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOwnerPassword=password1 -sUserPassword=password2 -dKeyLength=128 -dEncryptionR=3 -sOutputFile=output.pdf input1.pdf input2.pdf input3.pdf

Other Utility Mill scipts

I have made several utility mill scripts in the past and since I am reminded of it again, I might as well post links to my other utilities. Hopefully, someone will find it useful: Transmission Return Loss calculator - http://utilitymill.com/utility/ReturnLossCalculator Number to words converter to convert, eg. '123' to 'one hundred and twenty three' - http://utilitymill.com/utility/NumToEnglishWords

srt_delay: subtitle timing delay adjustment

I suppose SRT file timing offset is a common problem, however I can't seems to find any simple good tool that works on both Linux and Windows. While most media player on PC should be able to adjust the delays, my TV set-top box could open SRT files but could not adjust timing delays in the subtitle which could be annoying. So, I decided to roll up my sleeves and wrote the little utility python script in a few minutes. Besides, how difficult could a simple format like this http://en.wikipedia.org/wiki/SubRip ? You can download the script from pastie.org: http://pastie.org/1339071 I've released it as free and public domain . Anyone can use it to do anything you like. Anyway, for Windows folks, I have also made and online version by porting it to excellent python script hosting called Utility Mill . Just go to http://utilitymill.com/utility/srt_delay and follow the instructions.

Bilingual VCD to DVD

Image
Recently my mum wanted to replace her stack of VCDs to DVD. The VCDs are bilingual which is one language on each of the stereo channel. Since DVD supports VCD's MPEG 1 PAL (352x288) format as described in the mencoder manual , I thought I could just easily copy the video stream and transcode the audio stream to AC3 with the following mencoder recipe: mencoder -ovc copy -oac lavc -lavcopts acodec=ac3:abitrate=192 -srate 48000 -af lavcresample=48000 -of mpeg -mpegopts format=dvd:tsaf AVSEQ01.DAT -o AVSEQ01.mpg However, after burning the first disc with DVDStyler, I found that my Phillips DVD player does not allow switching between left and right channel for DVDs although language switching works fine with the original VCD. Thus, I have to split the single track stereo channel into two separate mono audio channel. After some experimenting with mencoder's audio filter, here's the recipe: mencoder -nosound -ovc copy -of mpeg -mpegopts format=dvd:tsaf AVSEQ01.DAT -o video.mpg men...

Transcoding video to H.264 for Nokia 5130

My wife is going to take a rather long journey bus this weekend. So, I decided to transcode some videos for her to watch on her phone. Here's the recipe: ffmpeg -y -i inputFile.avi -f mp4 -vcodec libx264 -level 30 -s 240x128 -b 200k -bt 768k -bufsize 10000k -maxrate 10000k -g 300 -coder 0 -threads 4 -acodec libfaac -ac 2 -ab 96k outputFile.mp4 This is mostly based on the instructions from the videohelp.com forum . I have tried 320x240 resolutions, but I decided to scale it down a little to save space since it does not look any worse at 240x128.