Skip to main content
zhongkez34561360
Inspiring
August 19, 2019
Answered

Custom file importer has inaccurate seeking frame index?

  • August 19, 2019
  • 2 replies
  • 1013 views

Hi all, I have developed a file importer for my own. With this plugin, Premire can recogize my file extension without error and it can import my files as expected.

But I noticed that the seeking frame index get from callback function SDKGetSourceVideo is not accurate sometimes. For example:

static

prMALError

SDKGetSourceVideo(

imStdParms *stdparms,

imFileRef fileRef,

imSourceVideoRec *sourceVideoRec)

{

int ret;

ImporterLocalRec8H ldataH = reinterpret_cast<ImporterLocalRec8H>(sourceVideoRec->inPrivateData);

ImporterLocalRec8Ptr localRecP = reinterpret_cast<ImporterLocalRec8Ptr>(*ldataH);

// Get parameters for ReadFrameToBuffer()

imFrameFormat* frameFormat = &sourceVideoRec->inFrameFormats[0];

prRect theRect;

// Windows and MacOS have different definitions of Rects, so use the cross-platform prSetRect

prSetRect(&theRect, 0, 0, frameFormat->inFrameWidth, frameFormat->inFrameHeight);

localRecP->PPixCreatorSuite->CreatePPix(sourceVideoRec->outFrame, PrPPixBufferAccess_ReadWrite, frameFormat->inPixelFormat, &theRect);

csSDK_int32 theFrame = static_cast<csSDK_int32>(sourceVideoRec->inFrameTime / (*ldataH)->theFile.frameRate);

...

}

The variable theFrame is the frame index with which Premiere get video frame from us. But the index is sometimes inaccurate. According to my log, it skipped some frames when playing:

We can see that the frame index is not continuous and it is even random sometimes. I don't know why. The file is kind of timelapse video with MJPEG format.

Can anybody give some advice? Thank you in advance.

This topic has been closed for replies.
Correct answer Bruce Bullis

I want the frames be requested in sequential order by Premiere but don't know how to do that.

Importers cannot control which frames PPro will request; those requests are prompted by user interactions, over which PPro has no control.

2 replies

zhongkez34561360
Inspiring
August 20, 2019

In fact, I found a option accessModes in structure imFileInfoRec8 passed in SDKGetInfo8():

prMALError

SDKGetInfo8(

imStdParms *stdParms,

imFileAccessRec8 *fileAccessInfo8,

imFileInfoRec8 *SDKFileInfo8)

{

    ImporterLocalRec8H ldataH = NULL;

    if (stdParms->imInterfaceVer >= IMPORTMOD_VERSION_6)

    {

        SDKFileInfo8->accessModes = kSequentialVideoOnly;

    }

    else

    {

        SDKFileInfo8->accessModes = kRandomAccessImport;

    }

    .....

}

I changed the accessModes to kSequentialOnly but it seems that doesn't work. I don't know if the option is related or not.

Bruce Bullis
Bruce BullisCorrect answer
Legend
August 20, 2019

I want the frames be requested in sequential order by Premiere but don't know how to do that.

Importers cannot control which frames PPro will request; those requests are prompted by user interactions, over which PPro has no control.

zhongkez34561360
Inspiring
August 21, 2019

Good to know that. Thank you.

Bruce Bullis
Legend
August 19, 2019

I see that the frames are not being requested in sequential order; what tells you that order is incorrect?

zhongkez34561360
Inspiring
August 20, 2019

Hi, thank you for your reply. In fact, the frame index is calculated by the expression:

csSDK_int32 theFrame = static_cast<csSDK_int32>(sourceVideoRec->inFrameTime / (*ldataH)->theFile.frameRate);

but the result is not continous. I want the frames be requested in sequential order by Premiere but don't know how to do that.