Giter Club home page Giter Club logo

subtitleframeextractor's Introduction

Introduction

中文版本

This project consists of a Python script that extracts frames from a video file and creates a subtitle collage. It uses OpenCV and PIL to handle video and image processing. The script captures frames at specified time points and extracts subtitle regions from those frames. These frames are then combined vertically to create a final image with the subtitle regions labeled with the respective time points.

Project Preview preview

Installation

To install the necessary dependencies, you can use the following commands:

pip install opencv-python-headless
pip install pillow

Usage

  1. Setting up the Script

Download the script.py file and open it in your preferred code editor.

  1. Modifying Time Points

Before running the script, you are advised to modify the time_points variable in the script to suit your needs. It is currently set to capture frames at every second from the 2nd to the 20th second. Adjust the values and the step in the np.arange function to specify different time points.

time_points = np.arange(2, 20, 1)  # Modify these values as needed
  1. Running the Script

The script is designed to be run from the command line with the following arguments:

  • video_path: Path to the video file
  • y_start: Start Y-coordinate of the subtitle region
  • y_end: End Y-coordinate of the subtitle region
  • output_path: Path to save the output image Example:
python script.py video_path y_start y_end output_path

Replace video_path, y_start, y_end, and output_path with the actual values for your use case.

subtitleframeextractor's People

Contributors

razor-wuwu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.