分类 UNIX & Linux 下的文章

How to Convert AVI to MP4 in Linux using Command Line

iPhone Video

If you want to play your AVI videos in your iPhone, iPod Touch or iPad, you must convert them to MP4 or H.264 format.

The following instruction is to let you convert your AVI video files to MP4 files.

1. You must have MPlayer and Mencoder. For more information about MPlayer and Mencoder, please refer Wikipedia at:

MPlayer: http://en.wikipedia.org/wiki/MPlayer
Mencoder: http://en.wikipedia.org/wiki/Mencoder

In Ubuntu, you can use install them as following command:

sudo apt-get install mplayer mencoder

2. If your AVI file is baby.avi and you want to create a MP4 called baby.mp4, you can type following command:

mencoder baby.avi -o baby.mp4 -oac copy -ovc lavc -lavcopts vcodec=mpeg1video -of mpeg

3. You can test the new MP4 file you just created using the MPlayer as below:

mplayer baby.mp4

How to Burn APE to Audio CD in Linux

APE Monkey Audio

1. Using FFMpeg or JMAC to Convert ape to wav:

.ape is the file extension for Monkey's Audio Files. Monkey's Audio is a pseudo-free lossless audio codec, like flac.

If you don't have ffmpeg, you can yum (for Fedora) or apt-get (for Ubuntu) to install it.

yum install ffmpeg
or
apt-get install ffmpeg


After you installed the ffmpeg, you can do this:

ffmpeg -i CDImage.ape CDImage.wav

CDImage.ape is the APE file you want to convert.

For whatever reason, if failed to convert the APE to WAV using ffmpeg, you could use JMAC to convert it. You need to make sure the Java Runtime Environment is installed. Then, you can download the JMAC package from http://sourceforge.net/projects/jmac/files/.

Only file you need is the jmac.jar. After unzipping JMAC package, you can find the location of the jmarc.jar and use it in the following command:

java -jar /path_to_the_file/jmac.jar d CDImage.ape CDImage.wav

2. Split APE with CUE:

You need to install bchunk to split the APE files. You can install it using yum or apt-get too.

yum install bchunk
or
apt-get install bchunk


After you installed the bchunk, you can do manual splitting as follows:

bchunk -w CDImage.wav CDImage.cue result

Where:
CDImage.wav is your large wav file
CDImage.cue is the cue file
result is the prefix for your wav songs (which gives you result01.wav, result02.wav...)


3. Burn to Audio CD:

You can use Brasero Disc Burner to burn the wav songs to a Audio CD.

Reference: http://gimpel.gi.funpic.de/wiki/index.php?title=Howto:convert_ape_to_wav/mp3/ogg_on_Linux/