The Square Hut - Ukrainian mashup of Bumfights, IP2 and Fishtank

That clip channel kind of sucks, lazy ~10 min clips of random shit.

The telegram clip channel https://web.telegram.org/k/#@topnarezki seems to have better short clips. Here are some random ones with subtitles











i (chatgpt) made a shell script to transcribe youtube videos/mp4s with OpenAI's Whisper and burn the subtitles on with ffmpeg. its below in case someone's interested
bash
python3
pip
ffmpeg
git

script's --setup will install the python dependencies:
torch, torchvision, torchaudio, openai-whisper, yt-dlp, ffmpeg-python
Bash:
#!/bin/bash

set -e

LANGUAGE="ru"
INPUT=""
USE_LANGUAGE=true
MODEL="medium"

# Track timing
declare -A TIMERS

to_minutes_seconds() {
    local duration=$1
    local minutes=$((duration / 60))
    local seconds=$((duration % 60))
    printf "%2dm %02ds" "$minutes" "$seconds"
}

start_timer() {
    TIMERS[$1]=$(date +%s)
}

stop_timer() {
    local name=$1
    local end=$(date +%s)
    local start=${TIMERS[$name]}
    local duration=$((end - start))
    TIMERS[$name]=$duration
    printf "⏱️  %-15s: %s\n" "$name" "$(to_minutes_seconds $duration)"
}

check_tool() {
    command -v "$1" >/dev/null 2>&1 || {
        echo "❌ Missing: $1"
        echo "👉 Please install it manually or run './translate_and_burn.sh --setup'"
        exit 1
    }
}

setup_dependencies() {
    echo "🔧 Setting up Python dependencies..."

    check_tool python3
    check_tool curl
    check_tool ffmpeg

    python3 -m venv venv
    source venv/bin/activate

    pip install --upgrade pip
    pip uninstall -y torch torchvision torchaudio || true
    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
    pip install git+https://github.com/openai/whisper.git
    pip install yt-dlp ffmpeg-python

    echo "✅ Dependencies installed."
    exit 0
}

download_video() {
    local url="$1"
    echo "📥 Downloading YouTube video..."
    yt-dlp -f bestvideo+bestaudio --merge-output-format mp4 "$url" -o "$VIDEO_OUTPUT"
    if [[ ! -f "$VIDEO_OUTPUT" ]]; then
        echo "❌ Download failed. File not found: $VIDEO_OUTPUT"
        ls -la
        exit 1
    fi
    echo "✅ Saved as: $VIDEO_OUTPUT"
}

run_whisper() {
    echo "🧠 Transcribing and translating using Whisper..."
    start_timer whisper

    if [ "$USE_LANGUAGE" = true ]; then
        whisper --task translate --model "$MODEL" --language "$LANGUAGE" -- "$VIDEO_OUTPUT"
    else
        whisper --task translate --model "$MODEL" -- "$VIDEO_OUTPUT"
    fi

    # Find any generated .srt file matching base name
    SUB_FILE=$(ls "${VIDEO_OUTPUT%.*}"*.srt 2>/dev/null | head -n 1)

    if [ -f "$SUB_FILE" ]; then
        mv "$SUB_FILE" "$SUBTITLE_OUTPUT"
        echo "✅ Subtitles saved as $SUBTITLE_OUTPUT"
    else
        echo "❌ Subtitle file not found. Whisper may have failed."
        exit 1
    fi

    stop_timer whisper
}

burn_subtitles() {
    echo "🔥 Burning subtitles into video using CUDA (h264_nvenc)..."
    start_timer burn

    ffmpeg -y -hwaccel cuda -i "$VIDEO_OUTPUT" -vf "subtitles=$SUBTITLE_OUTPUT" -c:v h264_nvenc -c:a copy "translated_${VIDEO_OUTPUT}"

    echo "✅ Output: translated_${VIDEO_OUTPUT}"
    stop_timer burn
}

# === Entry Point ===
if [[ "$1" == "--setup" ]]; then
    setup_dependencies
fi

# Parse arguments
for arg in "$@"; do
    case $arg in
        --lang=*)
            LANGUAGE="${arg#*=}"
            USE_LANGUAGE=true
            ;;
        http*)
            INPUT="$arg"
            ;;
        *.mp4)
            INPUT="$arg"
            ;;
    esac
done

if [[ -z "$INPUT" ]]; then
    echo "❌ Usage: $0 <YouTube URL or .mp4 file>"
    exit 1
fi

YOUTUBE_ID=$(echo "$INPUT" | grep -oE 'v=([a-zA-Z0-9_-]+)' | cut -d= -f2)
BASE_NAME="${YOUTUBE_ID:-$(basename "$INPUT" .mp4)}"
VIDEO_OUTPUT="${BASE_NAME}.mp4"
SUBTITLE_OUTPUT="${BASE_NAME}.srt"

check_tool yt-dlp
check_tool whisper
check_tool ffmpeg

# Download or copy
if [[ "$INPUT" == http* ]]; then
    download_video "$INPUT"
else
    if [[ "$INPUT" != "$VIDEO_OUTPUT" ]]; then
        cp "$INPUT" "$VIDEO_OUTPUT"
        echo "✅ Copied local file to $VIDEO_OUTPUT"
    else
        echo "ℹ️  Input file already matches expected name: $VIDEO_OUTPUT"
    fi
fi

start_timer total
run_whisper
burn_subtitles
stop_timer total

echo "============================="
echo "🎬 Done. Summary of durations:"
stop_timer whisper
stop_timer burn
stop_timer total
 
Back