By Werner Ruotsalainen on Thu, 11/22/2012
Given that a lot of iOS multimedia developers use my suite of test videos to conformance test their apps (see for example the iPad screenshot HERE, with the latest Moli_player Pro HD (a screen capture link showing my Finnish test video I've created and generally use for DVB TS multiple subtitle and audio track conformance testing)), I found it necessary to dedicate a separate article for a new subset of my conformance and speed test suite so that as many of them get notified of the changes as possible. In the article, I also give some info on how for example split H.264 streams should be made “well-formed” to be flawlessly inserted in, compared to MKV, more restricted containers like M4V.
Up until now, I've used the MKV files linked from THIS article for both hardware decoding and AAC / AC3 testing. The vast majority of players played them back just fine; a month ago, when publishing the article, it was only the then-current (3.5) version of the excellent multimedia player It's Playing that couldn't play them back in hardware – as is also mentioned in the article. (The now-current version 3.8 has no problems with these files any more. Of course, "thanks" to Dolby (dedicated news item) it can't play back the AC-3 audio any more, unlike any previous version.)
After investigating the reason for this, I've found out that the video stream in these three files lacks a starting keyframe because these streams were just “blindly” created with an MKV splitter tool (more on them below). This is perfectly OK in the MKV container, which does allow for such “malformed” H.264 files. Not so with M4V's (MOV's / MP4's), though – that is, the files It's Playing (or any other AppStore players offering semi-hardware MKV playback) remuxes the source MKV files in the background. These containers don't allow for videos without a starting keyframe; this is why It's Playing 3.5 refused to remux these files.
I've fixed these videos (but also kept the old ones for conformance testing; that is, the old links are still active); now, they're available as follows:
AC3 + AAC MKV
I've also remuxed them to M4V's (via the latest MP4Tools beta):
The new MKV's are played back flawlessly by It's Playing 3.5 - that is, the old version (still) incompatible with "malformed" H.264 files.
Which apps produce such files?
Generally, most (free) MKV splitter tools. In past articles (for example, HERE) I even provided a quick tutorial on using Mkvtoolnix for MKV splitting.
Smarter MKV editors may automatically add a keyframe to the beginning of these video streams.
How can you add a starting keyframe if you have a similar video file?
Just use ffmpeg. Issue the “ffmpeg -i <inputfilename> -acodec copy -vcodec copy -bsf h264_mp4toannexb <outputfilename>” command.
(BTW, this is also discussed in THIS thread. Consult that thread if you don't have ffmpeg and don't know where to download it from. HERE, I've even published a batch tool to quickly iterate over all MKV files in the current directory and save them as M2TS files, along with fixing the missing keyframe. In order to save to MKV files instead, just change “m2ts” to “mkv” in the script.)
UPDATE (29/Nov/2012): 1, I've updated both the MKV and M4V files with the double AC3 + AAC audio tracks. The previous version, because of an oversight, lacked the AAC tracks.
2, All these videos have H.264 level 5.1 video, which doesn't synch with the stock Videos app via iTunes. I've, now, also uploaded a version of the M4V version with level 4.1, which already can be synched. It's HERE. The related discussion is HERE.
UPDATE (30/Nov/2012): In the command section, I've been asked how one can preserve the subtitle tracks while remuxing.
Just add the “-scodec copy” flag if you only have only one subtrack (or, transferring it – and dropping the others - will be sufficient).
If you have more than one subtrack to transfer / save, also add “-map 0”, which transfers all of the tracks (as is also explained in section "5.13 Advanced options" HERE).
Note that copying will only work between similar container formats; for example, from an mp4 to a mov. That is, it'll work just fine in our case, when we just remux the video into the same container format to fix the key issue. An example is my standard test video HERE (originally linked from THIS article) with several subs. To quickly remux it, along with all its tracks, use the following command:
ffmpeg -i 2AACAudioAndManySubs.mov -acodec copy -vcodec copy -scodec copy -map 0 outfile.mov
You cannot use this for, say, quick MKV → MPV remuxing as MKV's use a different, non-mov_text subtitle format. That is, you can't use it with, say, the standardized Monsters test video. Also note that the original "-bsf h264_mp4toannexb" flag doesn't work with this video file.