Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Setting Camera Film Size Via Script

  • Setting Camera Film Size Via Script

    Posted by SJ Harris on November 26, 2022 at 9:24 pm

    Hello AE fans,

    I created a camera layer via script (see below)

    var myCam = app.project.item(3).layers.addCamera(“test”, [900, 400]);

    The only issue I have is that I cannot find a way to set its Film Size. There are options for other things but NOT film size. Am I missing something here? I looked at the docs and they give options for a lot of things (transform, position, scale etc…) but NOT Film Size. Film size isn’t even visible when you twirl the Camera Options.

    I’m probably missing something very basic but how do you set this when creating a camera?

    Thank you

    Filip Vandueren replied 10 months ago 2 Members · 3 Replies
  • 3 Replies
  • Filip Vandueren

    November 27, 2022 at 11:28 am

    Film size isn’t used for anything, other than calculating what the zoom-value should be if you want to enter the lens in mms too.

    AFAIK, as soon as you are out of the camera options window, none of those matter anymore, as everything is calculated in pixels.

    Why do you need to set it ? (because you are correct, it isn’t an available property via expressions and scripting)

  • SJ Harris

    November 27, 2022 at 2:23 pm

    Thank you for trying to help.

    I need to match real world cameras & set background layers. If I input the proper film size and lens it’s a match. Neither of these is available via script. I have no idea how to calculate this in pixels from the parameters available under Camera Layer > Camera Options

    I scoured the Adobe AE scripting docs and could not find anything that explains how all this is calculated in pixels.

    So for example: Zoom seems to be just lens length (adjusted for filmback size) but in pixels. How to use or adjust that outside the setup panel for the camera?

  • Filip Vandueren

    November 28, 2022 at 10:34 am

    Hi SJ,

    I believe this is the Math:

    Zoom (pixels) = thisComp.width (pixels) * Focal Length (mm) / Film Size (mm);

    (for “Measure Film size” horizontally, otherwise use comp height or calculate comp diagonal)

    The horizontal FOV is then:

    FOV = radiansToDegrees(2*Math.atan( thisComp.width / 2 / Zoom));

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy