# Introduction

This Guide will be a walkthrough for the encoding and muxing of an 4th- & 5th-generation iPod touch, iPhone 4, or iPad 1st generation & 2 compatible file from a video file. This guide is for use by anyone, newbie or advanced user. This Guide assumes that you know how to create an AVS script and calculate video bitrate. If you do not know how to create an Avisynth script then go here. If you do not know how to calculate video bitrate then go here.
It Covers:
* Setting up the required programs
* Encoding the audio, which involves encoding the audio to meet acceptable iPod standards.
* Encoding the video, which involves encoding the video correctly with x264.
* Muxing the resulted streams into an mp4 file to be imported to iTunes.
It does not cover:
* Subtitles.
* More than one Video or Audio Stream.
* 5.1 Audio

# Set up
## Basic Info

This section deals with downloading, installing and configuring the required programs correctly.

## Required Programs

* MeGUI. For guide on installing MeGUI, read the instructions here.
* Any DirectShow filter (or "Codec Pack") that can decode the source file format. There are a few free codec packs:
** The K-Lite Codec Pack is a complete solution of decoding the majority of files. It contains some more video and audio processing features comparing to the CCCP. Please visit for more information.
** The CCCP is a codec pack that installs a minimal set of filters that decode the vast majority of files (see for more info).

## Program Setup

* MeGUI: MeGUI requires no additional setup after you have fully updated it. By default, it will prompt you to update whenever there is one.

# Encoding audio
## Basic Info

This section covers encoding the audio to reach an iPod compatible standard.

## Setting up your iPod Profile

We are going to add an iPod profile to simplify future encoding for MeGUI.
* In the main window of MeGUI go to the audio section. In the Drop down list that is labelled "Codec", choose "Nero AAC: *scratchpad*". Click "Config".
* Set your settings like the ones shown on the right.
** In "Output channels", select "Downmix Multichannel to stereo".
** Select "Constant Bitrate". Set the slider to "320kbit/s".
** Set the AAC profile to AAC-LC
* Click "New". Type "iPod Profile". Click "OK"

## Encoding the Audio

All modern iPods supports AAC audio, and it is the best audio codec that MeGUI supports encoding to. We have to use the Nero AAC encoder as it is the only AAC encoder available in MeGUI.
* On the first page of MeGUI click the [...] button next to audio input. Browse for your input file and open it.
* Click the [...] button next to audio output. Remember the location of the file as it will be used later.
* Select your iPod Profile in the profiles drop down list.
* When you are ready, click Queue.

# Encoding video
## Basic Info

This section will walkthrough the encoding of an iPod-compatible video file using either Xvid or x264. You can't just use any settings to encode for the iPod, there are limits as it is a portable device and not capable of everything. Here's a table of the more generic restrictions.
iPod touch (4th generation) video specifications :
| | MPEG-4 AVC | MPEG-4 ASP |
| Bitrate | No restriction | 25000 kbps |
| Frame rate | 30 fps | 30 fps |
| Profile | Main @ 3.1 | Simple |
| Max resolution (pixels) | 1280 by 720 | 640 by 480 |
| Max 4:3 resolution (pixels) | 960 by 720 | 640 by 480 |
| Max 16:9 resolution (pixels) | 1280 by 720 | 640 by 360 |
| Container | .m4v, .mp4, or .mov | .m4v, .mp4, or .mov |
According to the table, AVC support is significantly better than ASP, so you are encouraged to use AVC.
Note: In your AVS file you will need to resize your video to iPod Standards. You can go below these standards if you like, but not above.

## x264 Preset Setup

We will set up an encoding preset for convenience.
* Open MeGUI to its main window.
* Select x264: *scratchpad* in the codec drop down list. Click "Config".
* Under Target Playback Device, select iPhone 4, iPad 1/2, iPod touch 4/5 in the drop down list.
* Click "New" under "Presets", type in "iPod".

## Encoding

Once you have finished creating your presets, you can use them! Return to the MeGUI main window.
* Select your Video Profile first. Use x264: iPod for X264 output.
* Open your AVS script if you have it, and create if not.
** When you are creating the AVS script, you must resize it to 1280 lines, or your iPod will not play it.
* Now, select RAWAVC for your container.
* Calculate your bitrate using Bitrate Calculator. Click "Yes" when asked if you want to copy calculated bitrate into video settings.
* Check that the input AVS script is OK with your iPod. Go to Tools -> AVC Levels Checker.
** If it outputs "This file matches the criteria", then you are good and click "OK".
** If it outputs other things, then there's something wrong. Make sure your source file is less than or equal to 1280 px by 720 px, or make another AVS script using the "Resize" feature in AVS creator.
* Finally, select your Video Output location. Remember that your encoded video will have an extension of ".264".
* Click Queue.

# Muxing streams
## Basic Info

This will cover the requirements of muxing a iPod capable MP4 file with an audio stream, a video stream, and an optional chapter stream.

## Muxing

* Open MeGUI. Click Tools. Scroll down to Muxer. Click MP4 Muxer.
* Under video input, browse for your encoded ".264" video file. Leave the Name section blank for safety.
* Under audio input, browse for your encoded ".mp4" audio file.
* Under chapters, you can add your optional chapter file.
* Under output, select your target device in "Device type" (iPod or iPhone).
* Scroll down to Muxed Output. Select your file destination. Click Queue.
When you are done, load the file into iTunes and transfer it to your iPod. Happy Viewing!