Skip to main content
Welcome to the MovieLite examples collection! This page provides an overview of all available examples, from basic editing to advanced compositing techniques.

Available Examples

All example code is available in the GitHub repository.

Basic Editing

Learn fundamental editing operations: cutting, concatenating, resizing, and positioning clips.

Effects Showcase

Explore the complete library of visual and audio effects including fades, blurs, color grading, and glitch effects.

Text Animations

Create dynamic text overlays with animations, gradients, shadows, and custom styling using Pictex.

Audio Mixing

Master audio track control, mixing background music, and applying audio effects to your videos.

Advanced Compositing

Build complex compositions with CompositeClip, AlphaCompositeClip, and understand when to use them.

Transitions

Apply smooth transitions between clips including crossfade, dissolve, and blur dissolve effects.

Masking Effects

Create sophisticated masking effects with image masks, text masks, and animated masks.

Rotation Examples

Rotate clips with static angles, animated spinning, custom pivot points, and quality settings.

Speed Control

Control playback speed for slow motion, time-lapse, and dynamic speed ramping effects.

Quick Start Examples

Extract a Subclip

Extract a 10-second segment from a video:
from movielite import VideoClip, VideoWriter

clip = VideoClip("input.mp4")
segment = clip.subclip(5, 15)  # Extract seconds 5-15

writer = VideoWriter("output_subclip.mp4", fps=clip.fps, size=clip.size)
writer.add_clip(segment)
writer.write()

clip.close()

Concatenate Multiple Clips

Join videos sequentially:
from movielite import VideoClip, VideoWriter

clip1 = VideoClip("intro.mp4", start=0)
clip2 = VideoClip("main.mp4", start=clip1.duration)
clip3 = VideoClip("outro.mp4", start=clip1.duration + clip2.duration)

total_duration = clip1.duration + clip2.duration + clip3.duration

writer = VideoWriter(
    "output_concat.mp4",
    fps=clip1.fps,
    size=clip1.size,
    duration=total_duration
)
writer.add_clips([clip1, clip2, clip3])
writer.write()

Add Simple Text Overlay

Add text to your video:
from movielite import VideoClip, TextClip, VideoWriter
from pictex import Canvas

video = VideoClip("input.mp4")

canvas = Canvas().font_size(60).color("white").background_color("transparent")
text = TextClip("Hello World", start=0, duration=5, canvas=canvas)
text.set_position((video.size[0] // 2 - text.size[0] // 2, 100))

writer = VideoWriter("output_with_text.mp4", fps=video.fps, size=video.size)
writer.add_clips([video, text])
writer.write()

video.close()

Example Categories

Basic Operations

Start here if you’re new to MovieLite:
  • basic_editing.py - Subclips, concatenation, resizing, opacity, positioning, looping
  • speed_examples.py - Speed control for slow motion and time-lapse effects
  • rotation_examples.py - Static and animated rotation with custom pivot points

Visual Effects

Enhance your videos with built-in effects:
  • effects_showcase.py - Complete showcase of all visual effects
  • masking_effects.py - Image masks, text masks, shape masks, and animations
  • text_animations.py - Dynamic text with position, scale, and fade animations

Audio

Work with audio tracks and effects:
  • video_audio_control.py - Control video audio tracks, mixing, and synchronization
  • Effects include fade in/out and volume control

Advanced Techniques

  • composite_clips.py - When and how to use CompositeClip and AlphaCompositeClip
  • transitions.py - Crossfade, dissolve, and blur dissolve transitions
  • Combining multiple effects and advanced compositing

Running the Examples

1

Clone the Repository

git clone https://github.com/francozanardi/movielite.git
cd movielite
2

Install MovieLite

pip install movielite
3

Navigate to Examples

cd examples
4

Prepare Your Media

Update the file paths in the examples to point to your own video, audio, and image files.
5

Run an Example

python basic_editing.py
Most examples have multiple functions. Uncomment the ones you want to run in the if __name__ == "__main__": section.
All examples use placeholder filenames like input.mp4, logo.png, etc. Make sure to replace these with paths to your actual media files before running.

Example Code Structure

Each example file follows a consistent structure:
"""
Description of what this example demonstrates.
"""

from movielite import VideoClip, VideoWriter

def example_specific_feature():
    """Demonstrate a specific feature."""
    print("Example 1: Feature description")
    
    # Example code here
    clip = VideoClip("input.mp4")
    # ... operations ...
    
    writer = VideoWriter("output.mp4", fps=clip.fps, size=clip.size)
    writer.add_clip(clip)
    writer.write()
    
    clip.close()
    print("Created output.mp4\n")

if __name__ == "__main__":
    # Uncomment the examples you want to run
    # example_specific_feature()
    pass

Getting Help

If you’re stuck or have questions about any example:

Contributing Examples

Have a cool MovieLite project? We’d love to add it to our examples collection!
  1. Fork the repository
  2. Create your example in the examples/ directory
  3. Follow the existing code structure and documentation style
  4. Submit a pull request
See CONTRIBUTING.md for guidelines.

Build docs developers (and LLMs) love