Introduction

mencoder is one of the most used applications along with ffmpeg to convert or encode videos.

Installation

Depending on what you will use, select only the one you wish:

1
apt-get install mencoder ffmpeg

If you want to create OGV (OGG/Theora) videos for HTML5, you need to install this package:

1
aptitude install ffmpeg2theora

Usage

Convert a .wmv to a .avi

1
mencoder "/path/to/file.wmv" -ofps 23.976 -ovc lavc -oac copy -o "/path/to/file.avi"

Convert a .mp4 to a .avi

1
ffmpeg -i "/path/to/file.mp4" "/path/to/file.avi"

And to convert an avi to mp4 and change to iPhone resolution:

1
ffmpeg -s 480x320 -i /path/to/file.avi /path/to/file_iphone.mp4

Convert a .flv to a .mpg

1
fmpeg -i get_video.flv -ab 56 -ar 22050 -b 500 -s 320x240 test.mpg

The options are:

  • b bitrate: set the video bitrate in kbit/s (default = 200 kb/s)
  • ab bitrate: set the audio bitrate in kbit/s (default = 64)
  • ar sample rate: set the audio samplerate in Hz (default = 44100 Hz)
  • s size: set frame size. The format is WxH (default 160x128)

Convert to ogv

1
ffmpeg2theora video.mov

This will keep the same video information and create an ogv file with the same name.

If you want better quality:

1
ffmpeg2theora --optimize video.mov

Resources

Last updated 02 May 2010, 21:43 CEST. history