Gentoo Wiki


This article is still a Stub. You can help Gentoo-Wiki by expanding it.


First we need to have mencoder, ffmpeg and the aac codec installed.

 # echo "media-video/ffmpeg aac" >> /etc/portage/package.use
 # echo "media-video/mplayer aac" >> /etc/portage/package.use
 # emerge -avt ffmpeg

My way is to convert the video in two passes: first one with mplayer to keep the aspect ratio? and the second one to create mp4 file. Here is the simple script for that:

File: /usr/local/bin/cvse
#!/bin/sh -f
## cvse - The SonyEricsson Video Encoder for Linux.
## Created by Vladimir Berezhnoy, 16.06.2007.
## Released under the GPLv2 or later.


#first pass, apply expand filter

mencoder -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 \
        -vf expand=${WIDTH}:${HEIGHT}::::1,scale=${WIDTH}:${HEIGHT} \
        -ofps 25 -of avi -o /var/tmp/tmp_se.avi "$1"

#second pass, encode audio & video

ffmpeg -i /var/tmp/tmp_se.avi -f mp4 -vcodec mpeg4 -r 25 -s ${WIDTH}x${HEIGHT} \
        -acodec aac -ac 1 "${PREFIX}$1.mp4" -aspect 4:3

exit 0


Make the script executable:

# chmod +x /usr/local/bin/cvse

And then just type

# cvse somefile.ext

The resulting file will be placed in the same dir with prefix se_

--Prizident 23:34, 15 June 2007 (UTC)

Retrieved from ""

Last modified: Mon, 08 Sep 2008 07:57:00 +0000 Hits: 3,258