TIP Encode Video for IPod

From Gentoo Linux Wiki

Jump to: navigation, search
This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

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

[edit] 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

[edit] Run

All that is left is to run ipodvidenc

ipodvidenc video.avi


[edit] Credits

Personal tools