So Long Perian

Posted by Thoughts and Ramblings on Monday, May 21, 2012

By now, most of your are familiar with our announcement that the Perian team is retiring. It was a long time coming, but still a sad day none the less. I can see that the community reaction is that of disappointment as well. Perian was so quiet in its arrival that I never stopped to realize how loud its departure may be. So I decided to recount my history with the project, through its trials and its joys. It was a wonderful ride, but now we leave it behind and ride off into the sunset.

Early Days

I’m sure many here don’t know it, but Perian existed previously in several pieces and none of them were called Perian. They were FFusion, AviImporter, and matroskaqt. I had used most of these pieces before the Perian project started, but none were satisfactory. On June 9, 2006, Augie approached me on IM and said “say, any interest in updating the the ffmpeg based quicktime component?” He had already dedicated a lot of work into improving FFusion and the AviImporter, and I decided to join him. I started to setup an SVN repository on my server, where it is still hosted to this day, but I needed a name. Augie was already using the name Perian, so I named the repository that as a temporary measure. The name stuck to this day. At first we built FFmpeg’s libav libraries into raw binaries which we checked into the repository, but we quickly transitioned to using an svn:external and making a build script to create x86 and ppc versions of the library. We even went as far as to patch FFmpeg to improve it’s compile procedures on the Mac and perform cross-compiling.

The Early Announcement

We were starting to prepare for a first release that essentially supported the common AVI files. A few days before the expected first release of Perian, I remember I was getting ready to teach class when I saw some comments that Perian had made digg. I had to quickly re-tune the web server to withstand the load from the story which would eventually receive over 4000 diggs. This was rather remarkable because at the time 4000 earned it a place on the front page and we didn’t have a single downloads to offer. We decided to step up our release date and put it out the next day. Amid preempting announcements and severe issues with sourceforge’s download servers, we had a rather successful first release.

Rising Star

Before the next release, the AppleTV was released, and within one day, it was hacked to get Perian installed (Sorry, original forum post is not publicly viewable). Then, a few months later, we released version 1.0. In this release we integrated mkv support A52Codec, subtitles, and a plethora of codecs and other file formats. Afterwards, we release 1.1 with a great number of speed improvements, most notably marking to QT which frames can be skipped in decoding for cases where a computer is too slow to decode entirely (such as the AppleTV).

During this time, I also started to work on the Sapphire Browser. Combined with Perian, this made the AppleTV a great set-top box for media playback. I proceeded to use this as my media playback for nearly 5 years, working on both the backend (Perian) and frontend (Sapphire).

Barriers

Working on Perian wasn’t without it’s share of problems. The first was a lack of great documentation in creation of a QT component. In some cases we resorted to a guess/check type of system which likely resulted in horrible abuses of the API, but it worked. We also had a problem with high-profile H.264. We noticed that it would crash when using Apple’s decoder, and when they later fixed the crashes, it would display around 1 or 2 frames per second. Perian could be made to decode H.264, but Apple’s codec was faster at main and baseline profile that we could achieve in Perian/FFmpeg. We resolved this by making Perian do the decode of high-profile H.264 but not on main or baseline profile. This was a particularly interesting hack considering the fact that all the profiles are the same codec, and we had to devise means by which to make Perian take priority for some of the profiles but not all. Apple has since corrected high-profile decoding in their codec to have decent speed for all profiles.

By far, the largest barrier was QT’s import limitations. When a QuickTime component imports a file, it must provide a series of location and sizes for each frame in the file (along with it’s associated display times and other information). While AVI has an index which provides this information in a single place, some formats do not. Fortunately, a component can do part of the file at a time, and incrementally import the file. This is what Perian does with MKV, and why it takes so long for an MKV file to become fully available. This still doesn’t handle other formats such as MPEG or ogg. MPEG has a single frame’s data split across multiple packets, meaning that the data is not contiguous. This is not a situation which QuickTime is designed to handle (See our rdar on the subject).

Finished Project

When we started releasing the 1.2 versions, Perian was starting to really look like it was as complete as we could make it. We were quickly hitting the end of what we could still accomplish. The improvements that we most wanted to add were not possible under QuickTime’s current architecture. Apple was promising a new architecture in QTX, but it has yet to be released. In the mean time, the developers started to move on to other things.

Perian accomplished our initial requirements and went beyond that. We could not have imagined a more successful project. Chris predicted that Perian would be bigger than Adium, which was a goal I didn’t see happening. Then Perian 0.5 had a shockingly high download count somewhere near 500,000. The download counts continued to grow, until Perian 1.2.3 came in at, as of today, 7,104,592!

The Future

I cannot speak for other developers, but I’m likely to move away developing Perian any further. Apple is not too likely to break the core functionality in Perian in the future, until they drop the old QT component architecture entirely. At that point, Perian would require a near complete rewrite to make it functional again. I doubt I’ll have the free time to dedicate to such an undertaking.

When Apple made the new AppleTV based on iOS, I knew that Sapphire’s days on the AppleTV were numbered. I predicted that hacking the new AppleTV would not be as fruitful as it was on the previous generation. My prediction turned out to be correct. Instead, I continued to work on Sapphire’s design even more. I soon realized that the AppleTV was a dead end as far as my media player needs were concerned, so I started to look at alternatives. Today, I have ported the core functionality of Sapphire over to the GoogleTV, and it’s a far better device at playback than the AppleTV ever was. The contrast is more visible when one notes that the AppleTV needed to be hacked, but the GoogleTV didn’t need any changes.

And so, here we are, at the end of a wildly successful project. We originally created it to satisfy a need in our own media playback, and gave it to the world. Apparently, millions had the same need. I want to thank Augie for his original concept of the idea and bringing me in on an early stage, Chris for his dedication in managing our little band of misfits and providing some excellent vision, David for bringing in matroskaqt his general cleanup of the code, and Alexander for take the brunt of the work in when others were not available. Finally, Perian, which itself is smaller than most mobile apps, has proven that truly great things can come in small packages. So long little guy, and may you continue to live on beyond after our retirement.


Legacy Comments:

Luigi Nica - Sep 3, 2012

Hello Graham. I don’t know if this is a good move - you know better I guess. Why not considering moving to a paid edition? Anyway, thanks for Perian. Have a nice day, Luigi

Graham Booker - Sep 3, 2012

Luigi, I just don’t have the time, even if paid. I have a full-time job and that reduces the utility of the money that could be obtained from paid side-project. I’ve also moved away from playing media files on the mac towards devices which are better designed for such a purpose, so my utility of Perian has been reduced as of late.

Niccolò Brogi - Nov 24, 2012

Perian was awesome!