Setting up mencoder with more codec support

petersk
  9 years ago
  5

Using Mencoder to Encode Videos

Introduction

For some reason a lot of codecs are not installed by default causing weird behaviour with mencoder (ie, not failing when transcoding, but not producing the right output (black screens)).

Here are the apt-get installs to get some codecs working:

  sudo apt-get install mencoder
  sudo apt-get install ffmpeg  <--- now libav-tools
  sudo apt-get install flac
  sudo apt-get install libdvdcss2
  sudo apt-get install subversion
  sudo apt-get install git
  sudo apt-get install yasm
  sudo apt-get install  libxvidcore-dev
  sudo apt-get install  libx264-dev
  sudo apt-get install w64codecs  <--- gone with medibuntu
  sudo apt-get install w32codecs  <--- gone with medibuntu
  sudo apt-get install libbluray1
  sudo apt-get install libbluray-dev
  sudo apt-get install libfaac-dev
  sudo apt-get install libjpeg-dev

One last one of use:

sudo apt-get install ubuntu-restricted-extras

Now to give it a try

In any movie there can be black bars.  mplayer can autodetect how to crop a video:

mplayer testgeorge.mpg -vf cropdetect -ss 12

The ss 'seeks' past the fist part of the video in seconds.  I use this if I happen to start a video early to make sure I don't miss the beginning.

Then, I do a two-pass encoding using the crop-detect settings:

mencoder testgeorge.mpg -oac mp3lame -ovc xvid -vf crop=1904:1072:8:6 -xvidencopts pass=1:cartoon -ss 12 -o /dev/null

This is the second pass:

mencoder testgeorge1.mpg -oac mp3lame -ovc xvid -vf crop=1904:1072:8:6 -xvidencopts pass=2:cartoon:psnr:bitrate=-300000 -ss 12 -o ../CuriousGeorge_Season5/Curious.George.S05E01.MarcoSoundItOut_MonkeysDuckling.xvid.avi

I hope that was useful.

Comments
marksuci 12 years ago

sudo apt-get install mencoder ffmpeg flac libdvdcss2 subversion git yasm libxvidcore-dev libx264-dev w64codecs w32codecs libbluray1 libbluray-dev libfaac-dev libjpeg-dev