iPhone Life magazine

Making the stock Videos application play every MP4 file possible

I've dedicated several articles (latest one HERE) to converting videos into MP4 (M4V / MOV) files so that they can be played back by the H.264 decoder of even older-generation iDevices. In the current one, I elaborate on how how you can play the output files with the built-in, stock Videos application. This article also belong to my Multimedia article series, in which I plan to publish a “Streaming multimedia over your local Wi-Fi” in the next few days and, then, finally, the real Multimedia bible. (As has already been stated in my previous multimedia-specific article, the work-in-progress feature & evaluation chart of the two just-mentioned articles is HERE. While it's still pretty much messed up, it already contains information you may find useful, should you want to have the BEST multimedia player for a given, even very special purpose like SSA / ASS subtitle rendering. The streaming-specific part of the chart is already ready and won't be extended, apart from some visual cleanup.)

If you don't want to use any third-party player on your iDevice to play these videos but want to strictly stick with the built-in Videos, you may have already run into the “XY was not copied because the video format is not supported by the iXZ "XY"” message like the following:



The two videos shown here are both part of the well-known video test suite available HERE and linked from the first, “Video testing samples” chart: the “Suzumiya” and the “Planet” (MKV) videos. (Both have been converted into MP4 – by only changing the audio track's encoding and channel number – by avidemux as is explained in my article dedicated to avidemux. Note that, should you want to convert the videos from MKV to MP4 with the current (1.8.10 ) version of Playback, it'll refuse to convert “Planet” - and, for that matter,  of the test suite, “Harry Potter” and , “Monsters” as well. I'll return to evaluating Playback, its UPnP and MKV -> MP4 conversion capabilities later, in my next article dedicated to streaming video on your Wi-Fi network.)

The problem is caused by Apple's long-outdated (and buggy) approach to synchronizing videos to iDevices. While all current (and even past, old ones like the iPad 1!) iDevices are fully capable of playing back even the most demanding H.264 videos, for some reason (it might be a simple oversight?), Apple doesn't let these videos synchronized to the Videos app on the iDevice.

This is caused by Apple's not allowing the synchronization of any videos above level 4.1. If you take a closer look at the chart I've linked to, you can see the “Enc opts” contains “high profile 5.1” for both videos. If, on the other hand, you try to (after converting them to MP4, of course) ones that contain “high profile 4.1” (or less) instead, they'll be happily synched to (and played back by) your iDevice; for example, “Harry Potter”, “Birds” and “Monsters”. The first of them uses “high profile 3.1”, the second two 4.1. Incidentally, “Birds”, which is also played back by even the A4-based iPhone 4, iPod touch 4 and iPad 1 flawlessly, uses a very high encoding bitrate: 40 Mbps. It equals to the maximal allowed bitrate of “true” Blue-ray discs (see THIS). Actually, the chart even mentions (see column “Note”: “Direct bluray (or hddvd) remux”) that the MKV file has been created by directly(!) taking a small chunk of a video from a Blue-ray disc without any kind of recompression (and drastically lowering the birate).

Note that, while the CPU/GPU would definitely be able to cope with it, you can only transfer 720p videos to your A4-based devices (iPhone 4, iPod touch 4 and the iPad 1). Even if you “downgrade” the video to high profile 3.1 or 4.1 (from 5.1), it won't be synced to these devices. With these devices, the only way to play back true 1080p content is using a third-party player (for example, GoodPlayer) able to utilize hardware video decoding. Also note that you can only sync 1080p to iPad 2's running iOS5+ but not previous, 4.x versions (dedicated article HERE)

The solution

The solution to the problem, apart from just purchasing an app (for example, GoodPlayer) that can directly play even high profile 5.1 H.264-based MP4 files using the hardware decoder, is modifying the video files in question. Fortunately, it's far easier than you might think: you do NOT need to recompress the video at all (taking even hours) but only need to change a single byte in the file.

If you have a Mac, just download THIS file. It looks for the above-mentioned “magic byte” in the video file you pass it to and changes it to be of 3.1. (You can also supply 4.1 instead of the default 3.1 by changing the “f.write(chr(0x1F))” statement to “f.write(chr(0x29))”. There isn't much point in doing so, though.) Please check out mcneildeal's post at Oct 23, 2010 9:17 PM in THIS thread for more info on the usage on both the Mac and Windows. Just overwrite the file iTunes previously declined to sync to your iDevice in the Movies tab and try syncing again.

Patching may be a bit time-consuming if the byte in question isn't at the end of the file (it's from there that the script starts seeking back from). Basically, if you use avidemux for the conversion into MP4, this will be the case. However, if you use the above-mentioned Playback for the conversion, it'll be at the beginning of the file, rendering the script very slow.

Windows

Windows has a dedicated and also-free app for the quick file patching: H264 Level Editor by CoolSoft. It's available HERE.

As opposed to the Python script I've spoken of in the previous section, it starts examining the file from the beginning. This means it parses videos repackaged by Playback reliably and, compared to the Python script, VERY fast – at least ones that haven't been re-processed by Subler to add subtitles. It couldn't handle  avidemux-repackaged files well.

Note that...

Non-standard MP4 files won't display subtitles in the stock player. For example, ones with built-in graphical (non-textual) subtitles like VobSub or external, textual SRT / SSA / ASS / SUB subtitles – more on this and similar stuff in my forthcoming multimedia articles. That is, not every MP4's and/or all their features will be compatible with your iDevice. Standardized ones will be.

 

UPDATE (05/04): for Mac users, Subler offers and even faster solution. Please read THIS.

Email icon
Want more? Get our weekly newsletter:

Werner Ruotsalainen is an iOS and Java programming lecturer who is well-versed in programming, hacking, operating systems, and programming languages. Werner tries to generate unique articles on subjects not widely discussed. Some of his articles are highly technical and are intended for other programmers and coders.

Werner also is interested in photography and videography. He is a frequent contributor to not only mobile and computing publications, but also photo and video forums. He loves swimming, skiing, going to the gym, and using his iPads. English is one of several languages he speaks.