Giter Club home page Giter Club logo

aftereffects-aep-parser's Introduction

aftereffects-aep-parser

This project is dedicated to reverse-engineering, parsing and exposing useful APIs for understanding Adobe After Effects AEP project files. This may be useful for a variety of reasons. For example, one might want to programmatically determine the number of compositions in a project, their resolution(s), framerate, etc. Traditionally, one would need to piggyback the ExtendScript engine running within After Effects to retrieve this information. While this procedure is fairly easy to accomplish, it is exponentially more resource expensive than static file analysis, and requires a running instance of the After Effects Scripting Engine (which can only be run on Windows and MacOS).

Quick Start

go get -u github.com/boltframe/aftereffects-aep-parser
package main

import (
  "fmt"
  aep "github.com/boltframe/aftereffects-aep-parser"
)

func main() {
  project, err := aep.Open("./my-project.aep")
  if err != nil {
    panic(err)
  }
  fmt.Println(project)
}

Contributing

Any and all contributions are welcome! There is no official procedure for contributing yet, but please start by opening a new issue describing your findings and anticipated contribution. Thank you!

Research Procedure

After Effects Project files are currently encoded using the Resource Interchange File Format (RIFF) in a Big-Endian byte-ordering (also known as RIFX). This can be confirmed by inspecting the first four bytes of any AEP file which will contain the following ASCII characters: RIFX..... Once parsed into Chunks, you can inspect the internal representation and attempt to understand its structure.

I have found that the online tool Kaitai is extremely helpful for quickly viewing structured binary data. I use the following (possibly outdated) language definition for validating AEP files:

meta:
  id: aep
  endian: be
  file-extension: aep

seq:
  - id: magic1
    contents: RIFX
  - id: file_size
    type: u4
  - id: magic2
    contents: Egg!
  - id: data
    type: blocks
    size: file_size - 4
    
types:
  blocks:
    seq:
      - id: entries
        type: block
        repeat: eos
  block:
    seq: 
      - id: block_type
        type: u4
        enum: chunk_type
      - id: block_size
        type: u4
      - id: data
        size: block_size
        type: 
          switch-on: block_type
          cases:
            'chunk_type::list': list_body
            'chunk_type::utf8': utf8_body
            'chunk_type::cdta': cdta_body
            'chunk_type::idta': idta_body
            'chunk_type::cmta': utf8_body
            'chunk_type::fdta': fdta_body
            _: ascii_body
      - id: padding
        type: u1
        if: (block_size % 2) != 0
  list_body:
    seq:
      - id: identifier
        type: str
        encoding: ascii
        size: 4
      - id: entries
        type: blocks
  utf8_body:
    seq:
      - id: data
        type: str
        encoding: utf8
        size-eos: true
  ascii_body:
    seq:
      - id: data
        type: str
        encoding: ascii
        size-eos: true
  idta_body:
    seq:
      - id: unknown1
        type: str
        size: 18
        encoding: ascii
      - id: id
        type: u2
  fdta_body:
    seq:
      - id: unknown1
        type: str
        encoding: ascii
        size: 1
  cdta_body:
    seq:
      - id: unknown1
        type: str
        size: 140
        encoding: ascii
      - id: width
        type: u2
      - id: height
        type: u2
      - id: unknown2
        type: str
        size: 12
        encoding: ascii
      - id: frame_rate
        type: u2
        
enums:
  chunk_type:
    0x4c495354: list
    0x55746638: utf8
    0x63647461: cdta # Composition data
    0x69647461: idta # Item data
    0x636d7461: cmta # Comment data
    0x66647461: fdta # Folder data

By making small changes to an After Effects project and uploading it to the Kaitai viewer, you can narrow down on how data is represented, and start to write additional language definitions and structures.

aftereffects-aep-parser's People

Contributors

nugthan avatar rioam2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aftereffects-aep-parser's Issues

Feature request: Start offset, Playhead position, Start Frame, End Frame

your work is awesome!

Using some hex comparers and editors I discovered where exactly in cdta composition start offset, playhead current frame, composition start frame and composition end frame are stored.

ae_hex

Skipping some bytes after cdta header, there is something stored there with lot's of empty space until Width and Height (pos: 2D0, at [0A, 0B, 0C, 0D]), probably reserved for large values, since all this stored as Frame * 2. I have no idea why it is stored as a multiply of 2, but that's how it is.

So, if it possible, could you please implement this fields for compositions? This would really help me with reading AEP files completely separately from AE.

Also, modifying corresponding values results in a modification of composition, which shown here: YouTube

My discoveries on the AEP format

Just in case someone's interested, I've been trying to figure out more details on the AEP format. I've documented my discoveries in here: https://lottiefiles.github.io/lottie-docs/aep/

I've also written a script that export the contents of an aep file into yaml, destructuring all the binary chunks into more useful data: https://gitlab.com/mattbas/python-lottie/-/blob/master/bin/aep_dump.py

I haven't been able to figure out everything, but I managed to extract information about a lot of different layer types, shapes, keyframes, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.