Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# YouTube Clip Extraction Tool

A professional tool for downloading and extracting precise clips from YouTube videos with timestamp control.

## ✨ Features

- Extract clips with precise HH:MM:SS timestamps
- Support for multiple timestamp formats (HH:MM:SS, MM:SS, SS)
- Automatic dependency management
- Cross-platform support (Windows, macOS, Linux)
- Professional project structure for team collaboration

## 🚀 Quick Start

### 1. Install Python

- Download and install Python 3.8 or newer from [python.org](https://www.python.org/downloads/)
- **Important:** Make sure to check "Add Python to PATH" during installation

### 2. Install Python Dependencies

Open a terminal in this folder and run:

```bash
pip install -r requirements.txt
```

### 3. Install FFmpeg

#### Windows
- Download from [FFmpeg Downloads](https://www.gyan.dev/ffmpeg/builds/) (get the release full build ZIP)
- Extract the ZIP file
- Add the `bin` folder to your PATH environment variable
- **Or use winget:** `winget install ffmpeg`

#### macOS
```bash
brew install ffmpeg
```

#### Linux (Ubuntu/Debian)
```bash
sudo apt update
sudo apt install ffmpeg
```

### 4. Configure Your Clip

Edit the configuration in the script or config file:

```python
YOUTUBE_URL = "https://www.youtube.com/watch?v=YOUR_VIDEO_ID"
START_TIME = "00:01:30" # 1 minute 30 seconds
END_TIME = "00:01:37" # 1 minute 37 seconds (7-second clip)
```

### 5. Run the Script

```bash
python video_processing.py
```

## 📖 Timestamp Formats

You can use any of these timestamp formats:

| Format | Example | Description |
|--------|---------|-------------|
| `HH:MM:SS` | `"01:23:45"` | 1 hour 23 minutes 45 seconds |
| `MM:SS` | `"23:45"` | 23 minutes 45 seconds |
| `SS` | `"45"` | 45 seconds |
| With decimals | `"01:23:45.500"` | With millisecond precision |

## 📁 Output

- Clips are saved in the `clips/` directory
- Files are named with timestamps for easy identification
- Original downloaded video is automatically cleaned up

## 🔧 Troubleshooting

### Common Issues

**"yt-dlp not found" error:**
```bash
pip install yt-dlp
```

**"ffmpeg not found" error:**
- Make sure FFmpeg is installed and added to your PATH
- Restart your terminal after installation
- Try running `ffmpeg -version` to verify

**Permission errors:**
- Run terminal as Administrator (Windows) or use `sudo` (macOS/Linux)
- Check that you have write permissions in the project folder

**Network/Download errors:**
- Check your internet connection
- Some corporate firewalls block video downloads
- Try a different video URL to test

### Verify Installation

Run this command to check if everything is installed correctly:

```bash
python -c "import yt_dlp; print('yt-dlp OK')"
ffmpeg -version
```

## 🤝 Team Collaboration

This project is designed for easy team sharing:

1. **Clone the repository**
2. **Run the setup instructions above**
3. **Edit configuration as needed**
4. **Share clips with your team**

## 📋 Requirements

- Python 3.8+
- Internet connection for downloading videos
- ~500MB free disk space (temporary)

## 📄 License

This project is open source and available under the MIT License.

---

**Need help?** Create an issue in the repository or contact the development team.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Redback Guide – YouTube Clip Extraction Tool

This guide explains how the tool is used in the **Player-Tracking** project to generate short, standardised clips for annotation in CVAT.

## 🎯 Purpose
The tool extracts 3–6 second clips from YouTube videos. These are used to label **Kick, Mark, and Tackle events**.


## 📌 Requirements for clips
- Duration: **3–6 seconds**
- Content: Must clearly show the action/event
- Quality: Should capture the complete sequence

## 🚀 How to use
1. Follow the setup in the original [README.md](./README.md).
2. For a single clip: edit `video_processing.py` with your URL, start, and end time.
3. For multiple clips: use a YAML file like [examples/clips.yaml](./examples/clips.yaml) and run:
```bash
python video_processing.py --batch examples/clips.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
01:15
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yt-dlp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@echo off
REM Setup script for Windows
python --version
IF %ERRORLEVEL% NEQ 0 (
echo Python is not installed. Please install Python 3.8 or newer.
exit /b 1
)

pip install -r requirements.txt

where ffmpeg >nul 2>nul
IF %ERRORLEVEL% NEQ 0 (
echo ffmpeg is not installed or not in PATH.
echo Please install ffmpeg from https://www.gyan.dev/ffmpeg/builds/ and add it to your PATH.
exit /b 1
)

echo Setup complete. You can now run python video_processing.py
Loading
Loading