mp4patch

There are many ways to convert video for your iPod/iPhone. You may use user-friendly GUI programs or command-line utilities like ffmpeg or mencoder… But almost none of them could embed soft sublitles to resulting mp4 file. Hard-coded subtitles are the best what they can.

But there’s a cross-platform tool called MP4Box to deal with mp4 containers. It can add subtitle streams by typing smth like:

mp4box -add source.mp4 -add subtitle.srt:lang=en output.mp4

This allows you to add audio tracks as well.

The resulted file will play great on a PC, but your iPod would fail to recognize subtitles and alternative audio tracks.

Solution

mp4patch is a small cross-platform utility to solve this incompatibility issue. It takes an mp4 file and changes it to make acceptable by iPod Touch and iPhone devices (older iPods don’t support soft subtitles and track selection).

Usage is quite simple:

mp4patch input.mp4

If you’re running Windows, you may download mp4patch binary. If you’re running other OS (or you’re a geek) you can compile it from source.

How to compile

First of all, download source code: mp4patch.c.

If you are going to compile it under Windows and Visual C++, you also need stdint.h header. Put it near the source.

If you’re using gcc, use smth like

gcc -o mp4patch mp4patch.c

If you’re using VC++, use

cl /GF /O2 /TP /I . /MT mp4patch.c /link /manifest
mt -manifest mp4patch.exe.manifest -outputresource:mp4patch.exe
del mp4patch.obj mp4patch.exe.manifest

Notes:
1. All the mess with manifest file is to make UAC happy.
2. /MT switch makes static linking with C runtime. You may use /MD instead to link dynamically and to get smaller output size.

If you use some other compiler, please refer to its documentation.