Conversions videos

From / Bloc Notes Informatique
Jump to: navigation, search

1 Introduction

mencoder is one the most used application with ffmpeg to convert or encode videos.

2 Installation

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

Command apt-get
apt-get install mencoder ffmpeg

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

Command aptitude
aptitude install ffmpeg2theora

3 Usage

3.1 convert a .wmv to a .avi

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

3.2 convert a .mp4 to a .avi

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

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

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

3.3 convert a .flv to a .mpg

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

Les options sont :

  • 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)

3.4 concert to ogv

Command fffmpeg2theora

This will keep the same videos informations and create and ogv file with the same name.

If you want a better quality :

Command fffmpeg2theora
ffmpeg2theora --optimize

4 Ressources