Skip to main content

Quickstart Guide

This guide will help you create your first typing simulation video in just a few minutes.

Prerequisites

Before you begin, ensure you have:
  • Python 3.9 or higher installed
  • pip package manager
  • A Python source file you want to simulate
You can verify your Python version by running python --version or python3 --version in your terminal.

Installation

1

Clone or download the repository

Get the VSCode Typing Simulator source code on your local machine.
2

Create a virtual environment

Navigate to the project directory and create an isolated Python environment:
python -m venv env
Then activate it:
source env/bin/activate
3

Install dependencies

Install the required Python packages:
pip install -r requirements.txt
This installs:
  • opencv-python==4.8.0 - For video encoding
  • numpy==1.24.0 - For array operations
  • pygame==2.5.0 - For graphics rendering

Create Your First Video

Now let’s create a simple typing simulation video!
1

Prepare a Python file

Create a simple Python file to simulate. For example, create hello.py:
hello.py
def greet(name):
    """Print a friendly greeting."""
    print(f"Hello, {name}!")
    print("Welcome to VSCode Typing Simulator")

if __name__ == "__main__":
    greet("World")
2

Run the capture script

Execute the main capture script:
python capture.py
3

Follow the prompts

The script will ask for three inputs:
Enter the file name to simulate (including .py extension): hello.py
Enter the output file name (without extension): my_first_video
Enter recording duration in seconds: 15
Don’t move your mouse or use the keyboard during recording. The process captures frames in real-time.
4

Wait for completion

The script will:
  • Display a 3-second countdown
  • Begin rendering the typing simulation
  • Save the output as my_first_video.avi
Progress is shown in the console as the video is being created.

Understanding the Code

Here’s what happens behind the scenes when you run capture.py:
capture.py
import time
import cv2
import numpy as np
import os
import pygame
from vscode_mockup import VSCodeMockup

def record_video(source_file, output_file, duration):
    # Configure video capture
    screen_size = (1280, 720)  # Fixed size for mockup
    
    # Use MJPG with AVI format for better compatibility
    fourcc = cv2.VideoWriter_fourcc(*'MJPG')
    out = cv2.VideoWriter(
        output_file + '.avi',
        fourcc,
        30.0,
        screen_size
    )
    
    if not out.isOpened():
        print("Error: Could not initialize video recording.")
        return
        
    print("Recording started successfully")
    
    try:
        # Read source code
        with open(source_file, 'r', encoding='utf-8') as file:
            code = file.read()
        
        # Initialize mockup
        mockup = VSCodeMockup()
        
        # Simulate typing and record
        mockup.simulate_typing(code, out)
            
    finally:
        out.release()
        cv2.destroyAllWindows()
        pygame.quit()
The record_video function:
  1. Initializes a video writer with MJPG codec at 30 FPS
  2. Reads your Python source file
  3. Creates a VSCode mockup interface
  4. Simulates typing character by character while recording each frame

Key Parameters

You can customize the typing simulation by modifying parameters in the source code:
ParameterLocationDefaultDescription
delayvscode_mockup.py:1450.1Time between each character (seconds)
width, heightvscode_mockup.py:151280, 720Video resolution
Font sizevscode_mockup.py:3914Editor font size in pixels
To speed up or slow down the typing animation, modify the delay parameter in the simulate_typing method in vscode_mockup.py:145.

Next Steps

Installation Guide

Learn about detailed installation options and troubleshooting

Configuration

Customize window size, typing speed, and more

Build docs developers (and LLMs) love