Copy link to clipboard
Copied
Hi Community,
I posted almost the same question in the Premiere Pro discussions and after no activity there, I thought I should post it here as this might be a better place for questions concerning the AE Plugin SDK.
I'm creating a video effect for Premiere Pro using the AE Plugin SDK and I'd like to analyse the current frame when the user pushes a button and then set some parameters based on the analysis.
Firstly, I managed to retrieve the current frame using PF_CHECKOUT_PARAM from within UserChangedParam() and set other parameters from the analysis however the returned layer is formatted as PrPixelFormat_ARGB_4444_8u and I need higher precision than 8-bit for the type of analysis being done, simply converting to float won't do it as I'm working from 10-to-16 bit log and linear footage.
Secondly, when I add the effect to an adjustment layer which does not begin at start of the timeline, the returned frame is not the frame under the cursor, since inData->current_time is apparently the current time relative to the beginning of the adjustment layer but param.u.ld holds data to the frame at inData->current_time relative to the beginning of the timeline.
I'm setting the following flags in GlobalSetup():
out_data->out_flags = PF_OutFlag_DEEP_COLOR_AWARE | PF_OutFlag_KEEP_RESOURCE_OPEN | PF_OutFlag_WIDE_TIME_INPUT;
out_data->out_flags2 = PF_OutFlag2_FLOAT_COLOR_AWARE | PF_OutFlag2_SUPPORTS_THREADED_RENDERING;
if (in_data->appl_id == 'PrMr') {
auto pixelFormatSuite = AEFX_SuiteScoper<PF_PixelFormatSuite1>(in_data, kPFPixelFormatSuite, kPFPixelFormatSuiteVersion1, out_data);
(*pixelFormatSuite->ClearSupportedPixelFormats)(in_data->effect_ref);
(*pixelFormatSuite->AddSupportedPixelFormat)(in_data->effect_ref, PrPixelFormat_BGRA_4444_32f);
}
And this is a code snippet from UserChangedParam():
PF_ParamDef param;
auto err = PF_CHECKOUT_PARAM(inData, ParamIndex::kInput, inData->current_time, inData->time_step, inData->time_scale, ¶m);
...
auto layer = ¶m.u.ld;
...
AEFX_SuiteScoper<PF_PixelFormatSuite1> pixelFormatSuite(inData, kPFPixelFormatSuite, kPFPixelFormatSuiteVersion1, outData);
PrPixelFormat format = PrPixelFormat_Invalid;
pixelFormatSuite->GetPixelFormat(layer, &format);
...
if (format == PrPixelFormat_ARGB_4444_8u) {
cv::Mat src(layer->height, layer->width, CV_8UC4, layer->data, layer->rowbytes);
...
}
PF_CHECKIN_PARAM(inData, ¶m);
Any hints as to how to obtain the current frame with float precision on a button press or how to deal with the time offset of the adjustment layer would be appreciated!
Copy link to clipboard
Copied
take a look at AEGP_RenderAndCheckoutFrame from AEGP_RenderSuite. it allows you to fetch any project item at any render settings.
obtain your effect's layer using AEGP_GetEffectLayer and then the layer item using AEGP_GetLayerSourceItem.
Copy link to clipboard
Copied
I tried to respond directly but it would not post, please see my response below. Thanks!
Copy link to clipboard
Copied
These "post flooding errors" are quite annoying, I can't seem to just reply to posts... I just read in the SDK docs that "No AEGP calls are supported by Premiere Pro."
Copy link to clipboard
Copied
For get a 32-bit frame, I've tried calling EffectWantsCheckedOutFramesToMatchRenderPixelFormat() in PF_Cmd_GLOBAL_SETUP but it's not made any difference, I'm still getting an 8-bit frame.
Copy link to clipboard
Copied
For the adjustment layer issue, I might see if I can deal with the time offset using callbacks from PF_UtilitySuite.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
you can skip AEGP_RegisterWithAEGP entirely. just pass a NULL to whatever function is asking for the id.
alas, i think none of the AEGP suites work in premiere...
Copy link to clipboard
Copied
Yes, you are right, I just read in the SDK docs that "No AEGP calls are supported by Premiere Pro" so I'll need to find another way.
Copy link to clipboard
Copied
In the sdk example you will find one that gives ARGB 8-bit and 16-bit frame for PPro.. Use it with appropriate comp settings to get 16-bit data.
I don't think PPro offer float data using AE SDK.