Home > APIs > AppServer API > Examples > Asset Management > Split and Combine Edits
Split and Combine Edits
At times it is useful to take a clip and split it into seperate sections or take separate sections and combine them into one. For example, you may want to take a simple clip that you crash recorded and insert other material at a particular point. In this case, you would split the clip into two different "edits" (i.e. sections of the clip) and then insert the new material between the edits.
Below is example code showing how to both split a clip into multiple edits and how to recombine edits. The full sample script can be downloaded from the example scripts page or from here: SplitAndCombineEdits.cs
// set full clip URI string clipUri = "edl/cmf//local/V:/default/TestClip"; // create a media mgr and get an editor for splitting and combining edits IMediaMgr mediaMgr = connection.AppServer.CreateMediaMgr(appName); ISimpleEditor3 editor3 = (ISimpleEditor3) mediaMgr.CreateEditor(clipUri); // split the clip into two different edit points string leftEdit, rightEdit, editID1, editID2, editID3; editor3.SplitEditAtPos("00:00:10.00", out leftEdit, out rightEdit); Console.WriteLine("left = " + leftEdit + ", right = " + rightEdit); editID1 = leftEdit; editID2 = rightEdit; // split the clip again editor3.SplitEditAtPos("00:00:30.00", out leftEdit, out rightEdit); Console.WriteLine("left = " + leftEdit + ", right = " + rightEdit); // note: edit2 is already equal to the left edit from previous step. // you can verify this with the print statements editID3 = rightEdit; // combine the first two edits string returnEdit = editor3.CombineNextEdit(editID1); Console.WriteLine("combine edit returned: " + returnEdit); // combine all edits editor3.CombineAllEdits(); // cleanup editor editor3.Detach(); editor3.Dispose();