Gentoo Wiki


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


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

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

Now we need to create the script that will handle converting for us.

File: ipodvidenc
## ipodvidenc - The iPod Video Encoder for Linux.
## Created by Eric Hewitt, January 9, 2006.
## Released under the GPL.  Go nuts.


echo "What would you like to name the output file (sans extension)?"

read output_file_name

echo "$output_file_name will be located in $PWD. Is this acceptable? [y/n]"

read output_file_loc_permis

if [ $output_file_loc_permis = 'n' ] || [ $output_file_loc_permis = 'N' ]
        echo "Where would you like to store $"
        read output_dir

ffmpeg -i "${input_file}" -acodec libfaac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -s 320x180 -title X "${output_dir}/${output_file_name}.mp4"

Now change the file permissions so we can execute it and place the file in to /usr/local/bin

# chmod +x ipodvidenc
# mv ipodvidenc /usr/local/bin

This script will generate a 16:9 video. Adjust the frame size (320x180, in the script) to your needs. 4:3 will be 320x240. Just pick 320 as width and calculate the height h.

For an original movie with size ow x oh:

h = oh x 320 / ow

(If h is odd, pick h+1 or h-1. ffmpeg will complain and exit if h is not even.)

If the video is played as 4:3, disable "Fit to Screen" in Videos > Settings. (This setting, when enabled, adjusts the video height to the screen size, cropping the image at the edges in non-4:3 movies.)


All that is left is to run ipodvidenc

ipodvidenc video.avi


Retrieved from ""

Last modified: Mon, 08 Sep 2008 07:57:00 +0000 Hits: 11,569