Linux freeze on high memory consumption

Sometimes when working with virtual images, R or python, I can see that the memory load is really high and then the system becomes completely unresponsive. This post will show you how to optimize memory management in linux so the system does not freeze.

Continue reading

Advertisements

Codify video with ffmpeg

To recodify a video with a different codec you can use ffmpeg with the following sintaxis:

ffmpeg -i inputfile -c:v  -c:a  outputfile

Where and are the codecs for video and audio channel to codify the intpu file.

To see all the available codecs write:

ffmpeg -formats

For example to recodify a video into h.264 for video channel and mp3 for audio:

ffmpeg -i input.AVI -c:v h264 -c:a mp3 output.mp4

To codify in mov:

ffmpeg -i input.AVI -acodec aac -ac 1 -ar 44100 -ab 64k -strict -2 -vcodec libx264 output.mov

Install Oracle JDK in Fedora 18

1. Download JDK from oracle

2. Install it as root:

[root@fc18]# rpm -i jdk-7u17-linux-x64.rpm

3. Define the alternatives

[root@fc18]# alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_17/bin/java 2
[root@fc18]# alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_17/bin/javac 2
[root@fc18]# alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_17/bin/jar 2
[root@fc18]# alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0_17/bin/javaws 2

4. Configure the alternatives for java

[root@fc18]# alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
 + 2           /usr/java/jdk1.7.0_17/bin/java
Enter to keep the current selection[+], or type selection number:

Enter 2, the jdk from oracle.

5. Repeat for all the alternatives:

[root@fc18]# alternatives --config javac
[root@fc18]# alternatives --config jar
[root@fc18]# alternatives --config javaws

Java plugin for Chrome:

1. Create the directory /opt/google/chrome/plugins

[root@fc18]# mkdir /opt/google/chrome/plugins

2. In /opt/google/chrome/plugins create the following soft links:

[root@fc18]# ln -s /usr/java/jdk1.7.0_17/jre/lib/amd64/libnpjp2.so 
[root@fc18]# ln -s /usr/java/jdk1.7.0_17/jre/lib/amd64/libjavaplugin_jni.so

3. Check the plugin appears in your chrome by entering the following url: chrome://plugins/

4. Test if your plugin is working by clicking on: http://www.java.com/en/download/testjava.jsp