Transparency KeyFrames

  • Vladimir Milovanov

    Need Help!
    Have to implement transparecy keyframes in AAF. Has anyone ideas how can I do it? Or, maybe, it's already implemented? Thanks in advance!

    • Oliver Morgan

      Oliver Morgan - 2009-08-01

      Hi. please can you explain a biit more what you want to achieve? is it curve-fitting parameter values by interpolating a series of known desired values at known time points relative to a source?

  • Vladimir Milovanov

    I've almost done it. My target was to create aaf file with video track, and the track's transparency is changing from one point to another. I'm making it using Cotrol Points. But faced such trouble:

    AxOperationDef AxVideoDslvOpDef( axDictionary.LookupOperationDef( kAAFEffectVideoDissolve ) );
    //operation group
    AxOperationGroup AxVideoDslvOpGroup( AxCreateInstance<IAAFOperationGroup>( axDictionary ) );
    AxVideoDslvOpGroup.Initialize(axVideoDataDef, 25, AxVideoDslvOpDef);
    AxTransition AxVideoDslvTransition( AxCreateInstance<IAAFTransition>( axDictionary ) );
    AxParameterDef AxVideoDissolveParm(AxCreateInstance<IAAFParameterDef>( axDictionary) );
    AxInterpolationDef AxVideoDissolveInterpolation(AxCreateInstance<IAAFInterpolationDef>( axDictionary ));
    AxVideoDissolveInterpolation.Initialize(kAAFInterpolationDef_Linear, L"LinearInterp", L"Linear Interpolation");
    //Varying value
    AxVaryingValue AxVideoDissolveVaryingValue( AxCreateInstance<IAAFVaryingValue>( axDictionary ) );

    Here Comes trouble:

        AxVideoDissolveVaryingValue.Initialize(AxVideoDissolveParm, AxVideoDissolveInterpolation);

    on this line exception appears:
    An exception of type 'System.Runtime.InteropServices.SEHException' occurred in MyAAFTest.dll but was not handled in user code

    Additional information: External component has thrown an exception.

    Have You any ideas why it appears  in this line? For example - wrong declaration of interpolation? Thanks in advance!

  • Oliver Morgan

    Oliver Morgan - 2009-10-16

    hi, I make little use of axLib myself, but I know that dissolves and interpolations and control points and varying values all work in the underlying impl. so I suspect that you have arrived at some part of AxVaryingValue that has never been tested.
    the best advice I can offer is to get out the dubugger and find out the origin of the exception

  • Jim Trainor

    Jim Trainor - 2009-10-16

    Can you get at the underlying HResult for the error that caused the SEHException?

    AxLib will map most HResults to an exception that includes a message, but I don't know what happens with it crosses the managed/unmanged boundry.

    From what I've read about SEHException, any exception in the C++ code that is not mapped to a .NET exception will cause an SEHException… so it could be any number of problems.

  • Vladimir Milovanov

    Hi. Now I'm trying to get inner exception. BUT…
    Maybe, I'm using wrong type of parameter? Which parameter must be used to change level of video dissolve effect? I'm using:

        AxParameterDef AxVideoDissolveParm(AxCreateInstance<IAAFParameterDef>( axDictionary) );
    AxVideoDissolveParm.Initialize(kAAFParameterDef_Level, L"Level", L"Dissolve Level", axDictionary.LookupTypeDef(kAAFTypeID_Rational));

      Is it correct?

  • Vladimir Milovanov

    Maybe, it would be better to use kAAFParameterDef_OpacityLevel ?

  • Vladimir Milovanov

    Sorry for spam))
    For now I can't get during debug into the source code , which throws exception, but I catched exception as AxExHResult and received AAFRESULT - AAFRESULT _INVALID _OBJ                     ((HRESULT)0x8012019B)
    File - AxParameter.cpp line 95

        CHECK_HRESULT( _spIaafVaryingValue->Initialize( spParameterDef, spInterpolation ) );

    I've investigated  underlying code, and found that in **ImplAAFVaryingValue.cpp**  in method **ImplAAFVaryingValue::Initialize** there is such string:

        result = SetInterpolationDefinition (pInterpolationDef);

    And in implementation of this method there is such string:


        if( !aafLookupInterpolationDef( this, pDef ) )

    I think that "my" exception is thrown here.
    Could You please look through my code above once again, and tell me where is the mistake in interpolation creation? Thanks in advance!

  • Jim Trainor

    Jim Trainor - 2009-10-21

    Hi,  The interpolation definition is an object in the dictionary in your aaf file that describes the kind of interpolation being used.  You either need to locate an existing definition in the dictionary or add one. Then provide a pointer to that object when you initialize your parameter object.  The error, and code fragment you tracked down, is telling you that there is a problem with the definition object you are passing in to the init method.  I suspect it is not in the dictionary and you may need to explicity add it before making the call to initialize the parameter object.

    BTW.  The exception is thrown by the AxLib wrapper.  It looks at the HRESULT (and integer return code) returned by the AAF COM interface, sees the error, and converts it into an exception.  You can bypass the axLib wrapper and call COM interface directly if it helps.  I do both when I use the AAF code… what ever works, however, mostly I use the axLib wrappers since coding against the bare COM interface calls is like stepping back 15 years.  There needs to be a good .net wrapper… but that's another subject.

    Good luck.

  • Jim Trainor

    Jim Trainor - 2009-10-21

    Another suggestion…. save your AAF file right before the error occurs.  Then dump it using a dump tool (there is one in the SDK).  Examine the contents of the dictionary and be sure that the interpolation definition exists.  If it doesn't then you need to add it.  If it does, then there is something wrong with the way your getting a reference to it.

  • Vladimir Milovanov

    I looked through the dictionary and found no interpolation definitions. After that I tried to add my own interpolation. I started from plugin definition creation:

        if (SUCCEEDED(hr)) hr = pMgr->CreatePluginDefinition(kAAFInterpolationDef_Linear, pDictionary, &pDefObject);

    but last line returned  **AAFRESULT_ CODEC _INVALID                   ((HRESULT)0x80120097)**

    I looked through my dictionary and found no plugin definitions. And no codec definitions.
    I tried to load default plugins

        if (SUCCEEDED(hr)) hr = pMgr->RegisterSharedPlugins();
        hr = pDictionary->CountPluginDefs(&defCount);

    after my attempt defCount were "0".
    Is it neccessary to use plugin for interpolation creation? I need simple Linear Interpolation. I thought that interpolation - is pure mathematic operation, and it doesn't need codec. Why I had to use such complex objects as plugins and codecs?

  • Vladimir Milovanov

    Oh! Fixed! But I don't know how)) I changed almost everything in my code.Whatever.
    I have only one question now: Is it correct to use Video Dissolve effect for changing transparency of video track? And is it correct to use kAAFParameterDef_OpacityLevel parameter? Can You advise something better? Thanks in advance!))))

  • Jim Trainor

    Jim Trainor - 2009-10-23

    Regarding the correctness of effects… I suggest reading what is recommended in the Edit Protocol:

    There is another new specification about effects called the "AAF Effects Protocol", but I can't find a link to it.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks