Skip to main content

Posts

Showing posts from June, 2010

Fixing AVIs with broken index or interleaving

Easiest thing. We simply copy the video and audio streams, and MEncoder generates the index. Of course this cannot fix possible bugs in the video and/or audio streams. It also fixes files with broken interleaving, thus the -ni option won't be needed for them anymore. Command: mencoder -idx input.avi -ovc copy -oac copy -o output.avi But it failed after 10 mins. of video for me.

To find duplicate entries in filenames

I have used a script to convert pictures from a party to two different sizes 640 and 1024. I have kept the right resolutions of chosen pictures and deleted the rest. But as usual duplicates remain. My ls command gives a list similar to the following. -rwx------ 1 aaaa aaa  39191 2010-06-28 22:49 2010-IMG_4354-640.JPG -rwx------ 1 aaaa aaa  41129 2010-06-28 22:49 2010-IMG_4355-640.JPG -rwx------ 1 aaaa aaa  46668 2010-06-28 22:49 2010-IMG_4356-640.JPG -rwx------ 1 aaaa aaa 121721 2010-06-28 22:49 2010-IMG_4359-1024.JPG -rwx------ 1 aaaa aaa 104468 2010-06-28 22:49 2010-IMG_4360-1024.JPG -rwx------ 1 aaaa aaa 164638 2010-06-28 22:50 2010-IMG_4361-1024.JPG I would just use this list to find the duplicates. My task is greatly simplified because of the great naming scheme. Same picture with different resolution only differ by the tag 640/1024 at the end. A single command finds our duplicates.  ls -l | cut -d "_" -f2 | cut -d "." -f1 | sed 's/-/\t/'

Laptop lid state

Laptop lid state is given by, cat /proc/acpi/button/lid/state To test if it works try, sleep 2 ; cat /proc/acpi/button/lid/state Now, close the lid and open after 2 secs. It will tell that the lid was closed.

Must have gmail mods

1.   Activeinbox http://www.activeinboxhq.com/install.html Turn emails into actions for easy email management Manage your emails as a flow of actions to get absolute control, minimize email overload and achieve inbox zero. Built using GTD® concepts. Always have a clear vision of things that need your attention Focus on high priority emails and see all the different projects flowing through your email. Build stronger relationships with replies that meet contact's expectations Serve contacts better with deadlined emails, complete control of current emails and by easily building on previous conversations. Effortlessly keep your email organized to stop Gmail becoming a blackhole Never forget an important email, retrieve knowledge stored in the depths of your archive and track every email you send. Nothing falls through the cracks 2. Gmailfs http://sr71.net/projects/gmailfs This is a Debian package which allows you to use GMail storage as a filesystem. Needs python-fus

Playing with video files in Linux

1. To extract audio from a video file -- $ mplayer my_video_file.avi -ao pcm:file=file.wav $ lame -f file.wav file.mp3 This creates a small size high quality mp3 file but it is very slow particularly if extracting the entire audio track of a movie. Mplayer takes ages to do the extraction. SO, it is better to use ffmpeg instead. $ ffmpeg -i my_video_file.avi extracted_audio.mp3 2. Convert any audio format to wav/mp3 -- $ mplayer file.rm -ao pcm:file=file.wav $ lame -f file.wav file.mp3  3. Convert any video format to avi -- FLV to mpg : Using ffmpeg : libavcodec is a library containing all the FFmpeg audio/video encoders and decoders. Most codecs were developped from scratch to ensure best performances and high code reusability. libavformat is a library containing parsers and generators for all common audio/video formats. $ ffmpeg -i jokes.flv -ab 56 -ar 22050 -b 500 -s 320×240 jokes.mpg jokes.flv is the file you want to convert, so the name must be the same as the

Disabling compcache for good

If a Ubuntu is installe from a CD or DVD chances are that along with the swap disk which physically exists on the hard drive Ubuntu also uses a RAM SWAP. This is a most annoying behavior because it leads to serious slowdowns and locks ups of the system. If you are one of those poor souls whose Firefox freezes up regularly after prolonged use even when not too many tabs are open then you are a victim of the Compcache. Even though it is boon for Live CDs it becomes the unwanted child in an installed Linux distribution. What do Compcache do ? I quote the webpage dedicated to Compcache ( https://wiki.ubuntu.com/Compcache ) "Compcache provides a possibility of using parts of the memory as virtual compressed swapdevice."  So Compcache creates a virtual drive in memory called the ramzswapfound at /dev/ramzswap0 and makes programs trick into storing their swap data there. This is not at all needed if a dedicated swap partition exists in a system. It interferes with the swappi

Change desktop folder and relocate music (due to space constraints) and still have the system recognise them

After I foolishly wiped my home folder clean (don't ask) my home folder became the Desktop. Whatever file I save there started to appear at the Desktop. Even after i created a folder called /home/me/Destop this continued. Also, due space constrainst I have moved my Music, Picture folders elsewhere. But I wanted my system to locate them. So finally I had to do something.  All I had to do was to edit the file ~/.config/user-dirs.dirs . -------------- before editing --------------  # This file is written by xdg-user-dirs-update # If you want to change or add directories, just edit the line you're # interested in. All local changes will be retained on the next run # Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an # absolute path. No other format is supported. # XDG_DESKTOP_DIR="$HOME/" XDG_DOWNLOAD_DIR="$HOME/" XDG_TEMPLATES_DIR="$HOME/"

Footnotes in LaTeX

Footnotes Adding a footnote in text is easy. For example: The article\footnote{Haptonstahl, 2002.} was pretty good. shows the text "The article 1 was pretty good." and adds a numbered footnote at the bottom of the page reading "Haptonstahl, 2002." If you want to add a footnote in a "forbidden mode" like in math mode, tables, or boxes, you have to do it in two easy steps. At the place you want the little superscript number (in the equation, for example) put \footnotemark Then, right after the "forbidden mode" ends, put the text of the footnote in the command \footnotetext{The text of the footnote goes here.} Admittedly, if there are multiple footnotes in the same "mode," this can get a little messy, but it can be done. Check the appropriate references. Suffice to say it can be done. Endnotes: Use the footnote commands as above. If you want all of the footnotes displayed in their own section at the end of the document -- en

Convert mp4 to mpg

Use ffmpeg ffmpeg -i strong.mp4 -ab 56 -ar 22050 -b 200  str.mpg See explanation of the parameters in the post http://kheyali.blogspot.com/2010/05/convert-flv-to-mpg-using-ffmpeg.html But this gives a blocky ouput. To finely control the quality of the output use -qscale option. -qscale 1 gives best image quality 2 ,3 ... are progressively worse but generate files of smaller size. It is all a size and quality balancing game. ffmpeg -i strong.mp4 -ab 56 -ar 22050 -qscale 6  str6.mpg