It’s based on the example for 2-pass encoding, with tweaks for things like QuickTime support: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;celoyd&#x2F;90cc919105248a2ddc95" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;celoyd&#x2F;90cc919105248a2ddc95</a>