Fast audio format convertion using ffmpeg

FFMPEG is the swiss army knife of Internet Streaming. As written in the homepage “is a very fast video and audio converter that can also grab from a live audio/video source. It can also convert between arbitrary sample rates and resize video on the fly with a high quality polyphase filter. “

Now, we are going to convert all FLAC files from a specific directory to MP3 256K.  It’s not a good idea from the quality perspective, but, you know, some players don’t support FLAC file.

First step is installing FFMPEG with all required codecs. If you are using a Debian base distro just run the following command:

# sudo apt-get install ffmpeg lame flac

unfortunately, ffmpeg is not part of Ubuntu 14.04 official repositories, so we need to add it before installing it:

# sudo apt-add-repository ppa:jon-severinsson/ffmpeg
# sudo apt-get update

Now from the source directory we can run something like that:

# (for FILE in *.flac ; do ffmpeg -i "$FILE" -f mp3 -ab 256000 "`basename "$FILE" .flac`.mp3" || break; done

this is only an example: ffmpeg can handle a lot of formats. To have a list:

# ffmpeg -formats

I suggest to read the official doc to go in deep

dmesg using human readable output format

dmesg – print or control the kernel ring buffer

dmesg output drives me crazy due to the timestamp. A lot of times I said: “there must be a way to human readable date !!!”  and now it is:

# dmesg -T

No vars and conversions, just a simple option !!

Unfortunately this option doesn’t work on old dmesg releases. On Ubuntu 12.10 (utili-linux v2.20), it works, no way for Red Hat 6 .

Fedora 19 (util-linux 2.23) can do better using color output and pager by the following option:

# dmesg -H

If  -T and -H option are not available, you can use the follow script:

# dmesg | awk -F ] '{"cat /proc/uptime | cut -d \" \" -f 1" | getline st;a=substr( $1,2, length($1) - 1);print strftime("%F %H:%M:%S %Z",systime()-st+a)" -> "$0}' | more


Vim as a Python IDE

Are you looking for the best Python IDE ?

From my point of view Vim is the best IDE, but you need to configure it properly to have debug, auto-indent &auto-completion features on it.

Martin Brochhaus at PyCon Asia Pacific 2012 Conference talk about use Vim as Python IDE using some cool plugins.

This is the code on Github:

GitHub vim-as-a-python-ide

You can also find the slides as a PDF in this repository and, above all, download the .vimrc file .

Another valuable link about customize Vim and install plugin is: How I boosted my vim

Linux commands in a nutshell

writing down a series of posts about GNU Linux one of the main purposes of this blog.
In these posts we are going to review some Linux commands with practical examples.This is not a complete but it’s a compact list of commands to refer when needed.These posts are not a linux training or a complete guide: you can use manpages for that (aka RTFM)The goal is share information about GNU Linux commands , improve my knowledge and use this website to cut & paste commands that I’m not able to remember 🙂

Bug fixes, suggestions and feedbacks are welcome as usual !

Posts list:

dmesg using human readable output format