The screen size for iPod/iPhone is 640×480.
I use ffmpeg tool to perform the transcoding.
The original 1080i video has a length of 1:13:31 – took over 12 hours to export from Vegas. The file size is 87.2GB. After the transcoding, the file size is 337MB!

The ffmpeg command I used is from here, two-pass x264 encode
ffmpeg -i input.avi -pass 1 -an -vcodec libx264 -vpre fastfirstpass -vpre ipod640 -b 512k -bt 512k -s 640x480 -threads 0 -f rawvideo -y /dev/null && ffmpeg -i input.avi -pass 2 -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -vpre ipod640 -b 512k -bt 512k -s 640x480 -threads 0 output.mp4
After another 12 hours transcoding, I realize that I made a mistake. The original movie has a aspect ratio of 16:9, but I transcoded the video into 640×480 (4:3)!!!! The correct ffmpeg command should be
ffmpeg -i input.avi -pass 1 -an -vcodec libx264 -vpre fastfirstpass -vpre ipod640 -b 512k -bt 512k -s 640x360 -threads 0 -f rawvideo -y /dev/null && ffmpeg -i input.avi -pass 2 -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -vpre ipod640 -b 512k -bt 512k -s 640x360 -threads 0 output.mp4
I didn’t want to run the correct ffmpeg command for another 12-hour. After some googling, I found a solution – use mp4box to change the aspect ratio. The command I used is
mp4box -add inputfile.mp4#1:par=4:3 -add inputfile.mp4#2 output.mp4
Great!
Now, I need some optimized ffmpeg code to transcode the 1080i video into a 720p video. I really don’t want to save this >80G giant, because none of my home computer can smoothly play it. Also, I believe that video in 720p has a good balance between resolution and file size. The following code from
Eugenia …
ffmpeg -y -i "export.avi" -threads 2 -f mp4 -vcodec h264 -level 41 -refs 2 -loop 1 -deblockalpha 0 -deblockbeta 0 -parti4x4 1 -partp8x8 1 -partb8x8 1 -me full -subq 6 -brdo 1 -me_range 21 -s 1280x720 -r 24000/1001 -b 4096k -bt 4096k -bufsize 15000k -maxrate 16000k -g 300 -coder vlc -acodec aac -ac 2 -ab 128k "720p-24.mp4"
… no longer works with the current version of ffmpeg (I am sure it worked 1.5 years ago) :-(
2 Responses to “Transcode 1080i video for playing on iPod/iPhone”
Leave a Reply
New in 'How-To'
Hot in 'How-To'
- analog – analog/digital – digital, VGA – DVI – HDMI - 13,432 views
- Ez-12 windsurfer antenna - 9,544 views
- How to add new ringtones to iPhone - 8,453 views
- mac osx 10.5.1 kalway on Lenovo Thinkpad T43 2668AJU - 6,637 views
- Install transmission using ipkg built packages in the MyBook World NAS - 4,838 views














Eugenia just sent me an email and pointed me to a software called HandBrake (http://handbrake.fr/)
HandBrake is an open-source, GPL-licensed, multiplatform, multithreaded video transcoder, available for MacOS X, Linux and Windows.
Supported Sources:
* Any DVD-like source: VIDEO_TS folder, DVD image or real DVD (unencrypted–protection methods including CSS are not supported internally and must be handled externally with third-party software and libraries), and some .VOB and .TS files
* Most any multimedia file it can get libavformat to read and libavcodec to decode.
Outputs:
* File format: MP4 and MKV
* Video: MPEG-4, H.264, or Theora (1 or 2 passes or constant quantizer/rate encoding)
* Audio: AAC, MP3, Vorbis or AC-3 and DTS pass-through (supports encoding of several audio tracks)
Misc features:
* Chapter selection
* Basic subtitle support (burned into the picture)
* Integrated bitrate calculator
* Picture deinterlacing, cropping and scaling
* Grayscale encoding
I don’t like the file generated from HandBrake. Now, I am using Tripp’s Unofficial FFmpeg Win32 Builds and running the following code
ffmpeg.exe -y -i "input.avi" -f mp4 -vcodec libx264 -s 1280x720 -r 24000/1001 -b 4096k -bt 4096k -acodec libfaac -ac 2 -ab 128k "720-24p.mp4"