Setting Up an EDL
If you want to encode specific segments from a digital device, such as a VTR, you can set up an edit decision list (EDL). You an encode EDL entries in any order and from multiple tapes. If you use multiple tapes, you will be prompted to change the tape. Your video tapes must contain proper time codes. To ensure that the time code in the tape is continuous, use a prestriped tape (one you have prerecorded continuously from beginning to end).
Each entry in an EDL requires a mark-in and a mark-out time. You can also add a tape ID if you use multiple tapes, and an entry description. Time for mark-in and mark-out values must be specified using the following formula:
TimeValue = ( ( ( ( hours * 60 ) + minutes ) * 60 + seconds ) * 1000 + milliseconds) * 10000
Visual Basic Example
' Create a WMEncoder object.
Dim Encoder As WMEncoder
Set Encoder = New WMEncoder
' Add the device as the audio source and the video source.
Dim SrcGrpColl As IWMEncSourceGroupCollection
Dim SrcGrp As IWMEncSourceGroup2
Dim SrcAud As IWMEncSource
Dim SrcVid As IWMEncVideoSource
Set SrcGrpColl = Encoder.SourceGroupCollection
Set SrcGrp = SrcGrpColl.Add("SG_1")
Set SrcAud = SrcGrp.AddSource(WMENC_AUDIO)
Set SrcVid = SrcGrp.AddSource(WMENC_VIDEO)
' Replace the following name with the name of your device.
SrcAud.SetInput ("Device://Device resource name")
SrcVid.SetInput ("Device://Device resource name")
' Configure the output and profile.
' Retrieve the device control collection, then add a device to it.
Dim DCColl As IWMEncDeviceControlCollection
Set DCColl = SrcGrp.DeviceControlCollection
Dim DControl As IWMEncDeviceControl
Set DControl = DCColl.Add
' Replace the following name with the name of your device.
DControl.SetInput ("DeviceControl://Device resource name")
' Initialize the encoding session.
Encoder.PrepareToEncode True
' Get the plug-in from the device.
Dim DCPlugin As IWMEncDeviceControlPlugin
Set DCPlugin = DControl.GetDeviceControlPlugin
' Retrieve an WMEncEditDecisionList object from the device
' control plug-in.
Dim EDList As WMEncEditDecisionList
Set EDList = DCPlugin.EditDecisionList
' Create an EDL entry.
Dim EDData As IWMEncEditDecisionData
Set EDData = EDList.Add
' Add attributes to the EDL entry specifying mark-in, mark-out,
' tape ID, and description information.
EDData.Add "MarkIn", 262695
EDData.Add "MarkOut", 267268
EDData.Add "TapeID", "A"
EDData.Add "Description", "Scene 1"
' Add another EDL entry.
Set EDData = EDList.Add
EDData.Add "MarkIn", 362695
EDData.Add "MarkOut", 367268
EDData.Add "TapeID", "B"
EDData.Add "Description", "Scene 2"
C++ Example
// Include libraries.
#include <windows.h>
#include <atlbase.h>
#include <comdef.h>
#include "C:\WMSDK\WMEncSDK9\include\wmencode.h"
#include "C:\WMSDK\WMEncSDK9\include\wmdevctl.h"
// Declare variables.
HRESULT hr;
IWMEncoder2* pEncoder;
IWMEncDeviceControlCollection* pDCColl;
IWMEncDeviceControl* pDControl;
IWMEncDeviceControlPlugin* pDCPlugin;
IWMEncEditDecisionList* pEDList;
IWMEncEditDecisionData* pEDData;
CComBSTR bstrName = NULL;
long lCount;
int i;
// Initialize the COM library and retrieve a pointer
// to an IWMEncoder interface.
hr = CoInitialize(NULL);
if ( SUCCEEDED( hr ) )
{
hr = CoCreateInstance(CLSID_WMEncoder,
NULL,
CLSCTX_INPROC_SERVER,
IID_IWMEncoder2,
(void**) &pEncoder);
}
// Configure the encoding session, including the sources, output, and profile.
// Retrieve the device control collection, then add a device to it.
if ( SUCCEEDED( hr ) )
{
hr = pSrcGrp2->get_DeviceControlCollection(&pDCColl);
}
if ( SUCCEEDED( hr ) )
{
hr = pDCColl->Add(&pDControl);
}
if ( SUCCEEDED( hr ) )
{
hr = pDControl->SetInput(CComBSTR("DeviceControl://DEVICENAME"));
}
// Initialize the encoding session.
if ( SUCCEEDED( hr ) )
{
hr = pEncoder->PrepareToEncode(VARIANT_TRUE);
}
// Get the plug-in from the device.
if ( SUCCEEDED( hr ) )
{
hr = pDControl->GetDeviceControlPlugin((IUnknown**)&pDCPlugin);
}
// Retrieve an WMEncEditDecisionList object from the device control plug-in.
if ( SUCCEEDED( hr ) )
{
hr = pDCPlugin->get_EditDecisionList(&pEDList);
}
// Create an EDL entry.
if ( SUCCEEDED( hr ) )
{
hr = pEDList->Add(&pEDData);
}
// Add attributes to the EDL entry specifying mark-in, mark-out,
// tape ID, and description information.
if ( SUCCEEDED( hr ) )
{
hr = pEDData->Add(CComBSTR("MarkIn"), CComVariant(262295));
}
if ( SUCCEEDED( hr ) )
{
hr = pEDData->Add(CComBSTR("MarkOut"), CComVariant(267268));
}
if ( SUCCEEDED( hr ) )
{
hr = pEDData->Add(CComBSTR("TapeID"), CComVariant("A"));
}
if ( SUCCEEDED( hr ) )
{
hr = pEDData->Add(CComBSTR("Description"), CComVariant("Scene 1"));
}
// Start encoding.
if ( SUCCEEDED( hr ) )
{
hr = pEncoder->Start();
}
// Release pointers.
if ( pDCColl )
{
pDCColl->Release();
pDCColl = NULL;
}
if ( pDControl )
{
pDControl->Release();
pDControl = NULL;
}
if ( pDCPlugin )
{
pDCPlugin->Release();
pDCPlugin = NULL;
}
if ( pEDList )
{
pEDList->Release();
pEDList = NULL;
}
if ( pEDData )
{
pEDData->Release();
pEDData = NULL;
}
if ( pEncoder )
{
pEncoder->Release();
pEncoder = NULL;
}
C# Example
using WMEncoderLib;
using WMDEVICECONTROLLib;
try
{
// Create a WMEncoder object.
WMEncoder Encoder = new WMEncoder();
// Add the device as the audio source and the video source.
IWMEncSourceGroupCollection SrcGrpColl = Encoder.SourceGroupCollection;
IWMEncSourceGroup2 SrcGrp = (IWMEncSourceGroup2)SrcGrpColl.Add("SG_1");
IWMEncSource SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
IWMEncVideoSource SrcVid = (IWMEncVideoSource)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
SrcAud.SetInput("Device resource name", "Device", "");
SrcVid.SetInput("Device resource name", "Device", "");
// Configure the output and profile.
// Retrieve the device control collection, then add a device to it.
IWMEncDeviceControlCollection DCColl = SrcGrp.DeviceControlCollection;
IWMEncDeviceControl DControl = DCColl.Add();
// Replace the following name with the name of your device.
DControl.SetInput("Device resource name", "DeviceControl", "");
// Initialize the encoding session.
Encoder.PrepareToEncode(true);
// Get the plug-in from the device.
IWMEncDeviceControlPlugin DCPlugin;
DCPlugin = (IWMEncDeviceControlPlugin)DControl.GetDeviceControlPlugin();
// Retrieve an WMEncEditDecisionList object from the device control plug-in.
WMEncEditDecisionList EDList = DCPlugin.EditDecisionList;
// Create an EDL entry.
IWMEncEditDecisionData EDData;
EDData = EDList.Add();
// Add attributes to the EDL entry specifying mark-in, mark-out,
// tape ID, and description information.
EDData.Add ("MarkIn", 262695);
EDData.Add ("MarkOut", 267268);
EDData.Add ("TapeID", "A");
EDData.Add ("Description", "Scene 1");
// Add another EDL entry.
EDData = EDList.Add();
EDData.Add ("MarkIn", 362695);
EDData.Add ("MarkOut", 367268);
EDData.Add ("TapeID", "B");
EDData.Add ("Description", "Scene 2");
}
catch (Exception e)
{
// TODO: Handle exceptions.
}
See Also