Skip to content

Video Conversions

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:

apt-get install mencoder ffmpeg

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

aptitude install ffmpeg2theora

Usage

Convert a .wmv to a .avi

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

Convert a .mp4 to a .avi

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

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

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

Convert a .flv to a .mpg

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

ffmpeg2theora video.mov

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

If you want better quality:

ffmpeg2theora --optimize video.mov

Resources