Search:  
Gentoo Wiki

TIP_Encode_Video_for_IPod

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

Installation

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
#!/bin/bash
## ipodvidenc - The iPod Video Encoder for Linux.
## Created by Eric Hewitt, January 9, 2006.
## Released under the GPL.  Go nuts.

input_file=$1

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' ]
then
        echo "Where would you like to store $output_file_name.mov?"
        read output_dir
else
        output_dir=$PWD
fi

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

Run

All that is left is to run ipodvidenc

ipodvidenc video.avi

Credits

Retrieved from "http://www.gentoo-wiki.info/TIP_Encode_Video_for_IPod"

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