Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to distinguish image sequence from normal video layer via scripting?

Explorer ,
Mar 18, 2017 Mar 18, 2017

I have a normal video layer and a jpg sequence layer inside my timeline. But how can I distinguish them?

My original method is that I can get its source file name, and distinguish them according to the file extension. For example, if its source file is a .mp4 file, it must be a normal video layer. If its source file is a .jpg file, then it must be a image sequence layer.

But the shortcoming is that we have so many image file extensions and video file extensions that can be imported into After Effects. To hardcode them all is not an efficient way, I think.

So, is there a better way to do this?

Guys, I need your help...

TOPICS
Scripting
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Mar 19, 2017 Mar 19, 2017

Hi Aaron.

The way I distinguish if it's image sequence of a video file, is checking for extensions.

Hope that help.

var fileType = getFileType(curFootage);

function getFileType(footageObject) {

    if (footageObject.hasVideo) {

        var filePath = File.decode(footageObject.mainSource.file);

        var extension = filePath.substr(filePath.lastIndexOf(".")+1,filePath.length).toLowerCase();

        if (footageObject.mainSource.isStill) {

            return "Still Image";

        } else if (extension.matc

...
Translate
Advocate ,
Mar 19, 2017 Mar 19, 2017

Hi Aaron.

The way I distinguish if it's image sequence of a video file, is checking for extensions.

Hope that help.

var fileType = getFileType(curFootage);

function getFileType(footageObject) {

    if (footageObject.hasVideo) {

        var filePath = File.decode(footageObject.mainSource.file);

        var extension = filePath.substr(filePath.lastIndexOf(".")+1,filePath.length).toLowerCase();

        if (footageObject.mainSource.isStill) {

            return "Still Image";

        } else if (extension.match( new RegExp ("(ai|bmp|bw|cin|cr2|crw|dcr|dng|dib|dpx|eps|erf|exr|gif|hdr|icb|iff|jpe|jpeg|jpg|mos|mrw|nef|orf|pbm|pef|pct|pcx|pdf|pic|pict|png|ps|psd|pxr|raf|raw|rgb|rgbe|rla|rle|rpf|sgi|srf|tdi|tga|tif|tiff|vda|vst|x3f|xyze)", "i"))) {

            return "Image Sequence";

        } else {

            if  (footageObject.hasAudio) { return "Video with Audio"; }

            else                        { return "Video";      }

        }

    } else if (footageObject.hasAudio && !footageObject.hasVideo) {

        return "Audio";

    }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 19, 2017 Mar 19, 2017
LATEST

Wow, thanks Tom! There are so many still image extension that I don't know. This function is AWESOME!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines