Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Wednesday, April 13, 2011

Encode/Scale video with MEncoder


The only thing I don't like about my old Canon S3 IS camera is that it records video without compression. Meaning that 4min 640x480/30fps vid is about 512MB...
I spend some time playing with MEncoder ("...a free command line video decoding, encoding and filtering tool released under the GNU General Public License" and a really *great* tool) and found a way to encode (or scale) my videos from Linux command line:

Encode from Canon RAW (acceptable quality):
$ mencoder INPUT.mpeg -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1800:mbd=2:trell=yes:v4mv=yes -o output.avi
Scale video:
$ mencoder INPUT.mpeg -vf scale=320:240 -oac copy -ovc lavc -lavcopts vcodec=mpeg4 -o OUTPUT.mpeg

-----------------------------------------------------------------------------------------------------------------

Create swap file in Linux

Some time ago when I was working with a BeableBoard-like dev board I had troubles creating Linux swap file. After reading some guides over the internet I'd like to share this simple how-to (Ubuntu):

1) Create "empty" file (~537 MB):
$ dd if=/dev/zero of=/swapfile1 bs=1024 count=524288

2) Setup Linux swap area:
$ mkswap /swapfile1

3) Activate swap space immediately:
$ swapon /swapfile1

4) Add to fstab (optional):
/swapfile1 swap swap defaults 0 0

To test:
$ free -m

To deactivate:
$ swapoff /swapfile1


Hope that someone would find it useful :)
-----------------------------------------------------------------------------------------------------------------

Tuesday, April 12, 2011

Different look for the Linux console

// lol...first "official" post


If you're bored of the default color your Linux console or want to change the look of it checkout the following example (Ubuntu):

Edit ~/.bash.rc with:

PS1="\n\[\e[32;40m\]| \[\e[31;40m\]\H \[\e[32;20m\]\d \[\e[32;1m\]\t \[\e[1;33m\]\w\[\e[0m\]\[\e[32;40m\]\n| \[\e[37;40m\]\u\[\e[1;37m\] \\$ \[\e[32;1m\]\[\e[0m\]"

and

force_color_prompt=yes


Output:


Feel free to modify :)
-----------------------------------------------------------------------------------------------------------------