Coder Social home page Coder Social logo

youclipper's Introduction

youclipper

youclipper is a Python-based command-line tool that leverages yt-dlp and ffmpeg to download and clip sections from online videos, such as those available on YouTube. It allows you to specify the exact start and end times, even down to milliseconds, to get the precise clip you need. You can also use the included yousubtitler to automatically create hard subtitles for your created clips.

Features

  • Download videos from YouTube and other platforms supported by yt-dlp.
  • Clip videos to your specified start and end times with support for millisecond precision.
  • Output your clip directly to a specified filename.
  • Subtitle your clips with word-level highlighting.

Installation

Before you use youclipper, ensure you have the following dependencies installed (or use the included requirements.txt with pip install -r requirements.txt):

  • Python 3
  • yt-dlp
  • ffmpeg
  • openai-whisper (or whisperx)
  • moviepy

You can install yt-dlp and ffmpeg using your operating system's package manager or download them directly from their official websites.

Here's how you can install ffmpeg on commonly used operating systems:

# On Ubuntu or Debian
sudo apt update && sudo apt install ffmpeg

# On Windows using Chocolatey
choco install ffmpeg

# On MacOS using Homebrew
brew install ffmpeg

Optional Dependencies

To install optional dependencies like whisperx, run:

pip install git+https://github.com/m-bain/whisperx.git

Usage

To view all available commands and their descriptions, you can use the --help flag:

python youclipper.py --help

Basic Clipping

To clip a video without specifying milliseconds:

python youclipper.py --url <video-url> --start mm:ss --end mm:ss --output <output-filename>

Clipping with Millisecond Precision

To clip a video and specify times down to the millisecond:

python youclipper.py --url <video-url> --start mm:ss.xxx --end mm:ss.xxx --output <output-filename>

Note: Replace with the actual URL of the video you wish to clip, mm:ss with the start and end times in minutes and seconds, xxx with milliseconds, and with the desired name of your output file (without adding the .mp4 extension, as it is appended automatically).

Subtitling Your Clips

You can use the included yousubtitler.py to subtitle your videos. This requires ImageMagick as well as the moviepy and openai-whisper (or whisperx) pip packages:

python yousubtitler.py inputfile.mp4

This will automatically create a subtitled version of your clip which will be in the format: <original_filename>_subtitled.mp4.

Configuration Flag for Subtitling

To choose between openai-whisper and whisperx for subtitling, set the USE_WHISPERX flag in yousubtitler.py:

# yousubtitler.py
USE_WHISPERX = True  # Set to False to use OpenAI's Whisper

Changelog

  • v0.14 - (yousubtitler) ditched pydub; using ffmpeg for all audio+video from now on
  • v0.13 - (yousubtitler) normalize audio to -0.1dBFS by default (can be set via true/false on NORMALIZE_AUDIO variable)
  • v0.12 - (yousubtitler) text animations (can be configured from yousubtitler.py)
  • v0.11 - (yousubtitler) added confirmation prompts for all subtitle entries + confirm overwrites
  • v0.10 - (yousubtitler) check for CUDA compatible GPU availablility on launch
  • v0.09 - (yousubtitler) added support for word-level highlighting subtitles using whisperx or openai-whisper.
  • v0.08 - (yousubtitler) included yousubtitler.py for quick, automatic hard subtitling of clips
  • v0.07 - (youclipper) recode instead of copying when clipping to avoid video/audio desync issues
  • v0.06 - (youclipper) first public release

Contributing

Contributions to youclipper are welcome! If you have suggestions for improvements or encounter any issues, please open an issue or submit a pull request.

About

Developed by FlyingFathead, with ghostcode by ChaosWhisperer.

youclipper's People

Contributors

flyingfathead avatar

Stargazers

 avatar

Watchers

 avatar  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.