DVEdit: Examples

Home | News | To-Do | Features | Examples | Tutorial | API Documentation | Download

To give a quick glimpse of DVEdit's characteristics, let's take a look at a few example script files

1. Simple Transcoding

A basic 'Hello, World' example
  #!/usr/bin/env python
  from dvedit.core import File
  File("myrawclip.vob").render("another.avi")
  

2. Clip Excerpts and Joins

Demonstrates basic cut/paste using python '+' and list slice operator.
  #!/usr/bin/env python

  from dvedit.core import *

  # get the raw clip
  clip = File("myrawclip.vob")

  # get one cut - first 45 secs (1125 frames @ 25fps)
  part1 = clip[:1125]

  # get another cut - 20 secs, starting at 2mins10
  part2 = clip[3250:3750]

  # join these two excerpts, which creates another clip object
  result = part1 + part2

  # can pass ffmpeg options in to the render call
  result.render("another.avi", "-f avi -vcodec mpeg4 -b 2000000 -acodec mp2")
  

3. Transitions

It's easy to create a clip which consists of one clip cross-fading to another clip:
  #!/usr/bin/env python

  from dvedit.core import *
  from dvedit.transitions.crossfade import CrossfadeTransition

  # this is the same as before
  clip = File("myrawclip.vob")
  part1 = clip[:1125] # first 45 secs (1125 frames @ 25fps)
  part2 = clip[3250:3750] # 20 secs, starting at 2mins10

  # create the composite clip which is a 5-second transition (125 frames)
  result = CrossfadeTransition(part1, part2, 125)

  # now can render out
  result.render("another.avi")
  

4. Timelines and Filters

  #!/usr/bin/env python

  from dvedit.core import *
  from dvedit.filters.inverse import InverseFilter

  # get raw source material
  clip = File("myrawclip.vob")

  # make a timeline
  seq = Sequence()

  # at frame 25, put the first 100 frames of clip
  seq.add(clip, 25, 100)

  # at frame 150, put 200 frames beginning at 60 secs (1500 frames) into the clip
  seq.add(clip, 150, 200, 1500)

  # apply inverse video effect between 2 and 5 seconds
  seq.filter(InverseFilter, 50, 75) # 2sec=50, duration= 5-2 = 75 frames

  # now can render
  seq.render("another.avi")