Exporting from After Effects to H.264 using x264

When exporting an 8 bit After Effects composition to a lossy format, you may end up with gradients that show visible banding, and the lower the bit rate, the worse the banding.

You may get better results by upping the bit depth on the composition to 16 bits, but you still will be depending on the downsampling algorithm within the AE Render Queue, or Adobe Media Encoder. And you’re also stuck with the codecs exposed through those pieces of software.

If you want to use x264 to have finer control over your encode, especially at very low bit rates, and stay compatible with specific target devices, such as the iPhone or iPad, you will most likely face the problems of feeding 16 bit image sequences to x264 via mplayer, or use some unholy avisynth script, as x264 will not accept ProRes or any other higher bit rate format natively.

One possible solution for this problem is using the QuickTime x264Encoder component. It will work within After Effects’ own Render Queue, QuickTime Pro, or Compressor and will accept any input QuickTime accepts. So simply export your AE 16 bit sequence directly to H.264 using the x264Encoder component, or export it first to ProRes 4444, and feed it to x264 via the component, with a lot of x264’s options exposed.

Update: Surprisingly, the component also works reasonably well within Qmaster distributed encoding. You may want to experiment with multithreading within the component’s settings vs. multithreading in Qmaster, or both. Provided you have enough storage and RAM and a fast network, this works true wonders when encoding hours of video at a time.

Philipp und Philipp unterhalten sich

Philipp und Philipp unterhalten sich… mit Timo. Wertvolle TV-Unterhaltung mit Club Mate, Döner-Pizza und dem unvergleichlichen Videokassetten-Domino-Tag*

Philipp und Philipp unterhalten sich mit Timo


Gespannt auf die neue Sendung mit Timo Hetzel und Philipp Seidel? In den Newsletter eintragen und informiert werden, wenn die App erscheint.

* Ähnlichkeiten mit tatsächlich existierenden Domino-Tag-Fernsehformaten sind rein zufällig.

Server-side Auto Renewable Subscription Receipt Verification

Update 10/2011: Watch the WWDC 2011 video on in-app purchases. This clarifies some of the points in this post and introduces a handful of useful fields in the receipt.

I think Apple’s documentation on checking receipts for auto-renewable in-app subscriptions is a little sparse. I overlooked this paragraph when first reading the documentation and wasn’t aware of its ramifications.

In App Purchase Programming Guide:

The response also includes an additional latest-receipt field; if the user’s subscription is active and was renewed in a transaction that took place after the transaction you provided to the App Store, the latest-receipt field includes a new base-64 encoded receipt for the latest renewal for this subscription. Your server can use this new receipt to maintain a record of the most recent renewal.

Here’s a sample response where receipt and latest_receipt are identical, we’re inside the first subscription period.

Screen shot 2011-04-01 at 12.48.50

When your app is launched regularly, everything is just about the same as with good old-fashioned non-consumable subscriptions. The app receives restored transactions to verify via your server.

When the app isn’t launched, you may still want to be able to stay in sync with the user’s subscription, even when he is not running the app. You can have a scheduled task on your server that can periodically replay the last known receipt to Apple, and if the latest_receipt differs from the receipt you just sent, you can send it right back to Apple to get the latest renewal date.

latest_receipt_info is not documented, so it might be a safer bet to actually use latest_receipt’s contents.

Use the purchase_date within the latest_receipt to calculate the current subscription period. The length of time for every period is not contained within the receipt date, so you need to calculate it from your product_id or item_id.

By doing this, you can maintain accurate subscriber stats on the server or grant paying users web access to content originally purchased in the app.