Thursday, 5 January 2012

Split a Media Video File (AVI, FLV,...) using Mencoder and Mplayer

Mencoder is a movie encoder program that allows us to split a media video(e.g AVI) file into several AVI files.

We are going to split a media video file maintaining same video and audio codecs.

As mencoder accepts other file formats than avi files, we will be able to split them too, but result will be avi files.


SPLIT ONE FILE INTO TWO


E.g: We are going to split foo.avi file into foo1.avi(600 seconds long) and remaining length in foo2.avi.

Following mencoder man page advice, we could try these options:
$ mencoder foo.avi -o foo1.avi -oac copy -ovc copy -endpos 600
$ mencoder foo.avi -o foo3.avi -oac copy -ovc copy -ss 600


mencoder options:

Wednesday, 4 January 2012

Swapping on a File in Linux

This article shows how to create a standard file and configure your linux based system to activate swapping or paging on it.

CREATE THE SWAP FILE


First we create the swap file using dd command. cp is not useful here because swap file has not to contain holes.
# dd if=/dev/zero of=/mnt/swapfile bs=1M count=200 # We create a swap file of 200MByte in size.

For safety we disallow other users to read and modify the file:
# chown root.root /mnt/swapfile
# chmod 600 /mnt/swapfile

Swap size is unlimited for linux kernels after 2.3.3
Kernels after 2.4.10 support up to 32 swap areas.


SET UP THE SWAP FILE