Expression to subtract frames of 2nd layer that does not match the 1st layer

New Here ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

So Hi everyone, this is my very first post. 

Actaully I have two videos in seperate layers, the video on 2nd layer has some frames missing whcih are present in the 1st layer video. I want an expression which would compare the both videos (like you choose subtract or difference in Mode) and if the frame of 2nd layer does not match the 1st one, it deletes it from 1st video and then continue...! I have a code in my mind but I don't know the variables. Here it is:

if(thisLayer.thisframe != 2ndLayer.thisFrame){
delete the frame of thisLayer.thisFrame;
continue comapring;
}

In other words keep the union of two sets and delete the rest. A = {1,2,3}, B = {1,3} output = {1,3}. 

The two videos are in black & white and color versions. So you can't say I should use smaller of it 🙂

Can any one help me with this or tell me whether it's possible or not?

TOPICS
Expressions , FAQ , How to , Scripting

Views

54

Likes

Translate

Translate

Report

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

Community Expert , Aug 18, 2022 Aug 18, 2022

I think you would probably need the power of AE's plugin API to do that. Expressions only have sampleImage() to look at pixel data, and it would be ridiculously inefficient to try and detect missing frames that way. Scripting doesn't even have that capability, so I think you'd have to create a plugin, which should provide the tools you need, but has a steep learning curve. 

Likes

Translate

Translate
Community Expert ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

I think you would probably need the power of AE's plugin API to do that. Expressions only have sampleImage() to look at pixel data, and it would be ridiculously inefficient to try and detect missing frames that way. Scripting doesn't even have that capability, so I think you'd have to create a plugin, which should provide the tools you need, but has a steep learning curve. 

Likes

Translate

Translate

Report

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
Community Expert ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

AE Beta has Scene detection: https://community.adobe.com/t5/after-effects-beta-discussions/scene-edit-detection-available-in-afte...

 

If Scene detection could detect the missing frames, you might be able to get a start on simplifying the process.

 

If the two shots are identical except for the missing frames, you could apply the difference mode and watch a preview. When the frames don't match, that's where a frame is missing. Unfortunately, this would have to be a manual process. The total number of frames in both layers would tell you how many are missing.

 

I am not sure why you would not just duplicate the layer without missing frames. Maybe you can explain your workflow and your design goals a little better.

Likes

Translate

Translate

Report

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
Community Expert ,
Aug 18, 2022 Aug 18, 2022

Copy link to clipboard

Copied

LATEST

As already pointed out by @Dan Ebberts expressions cannot manipulate pixel data. You would have to create a plug-in that does what you need. There is no such thing out there and short of a mostly manual process with extracting and removing the frames the hard way I can't think of much. Most effects I'm aware off would simply try to synthesize and fill in gaps of missing frames from neighboring ones, not actually compare it to other footage and remove stuff.

 

Mylenium

Likes

Translate

Translate

Report

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