One-Cut Style: A simple script to instantly remove video intro ads for a clean viewing experience.


1. Introduction

As a programmer who loves life, learning, and collecting high-quality resources, watching movies and series during coding breaks is quite normal.

Movies require immersion, focus, and atmosphere. But some unscrupulous publishers insist on adding dozens of seconds or minutes of advertising intros: “Exclusively released by XXX in HD!”, “Follow us and never get lost!”, “…Available nationwide”, plus music, logos, and 10-second silent background images.

Who can tolerate this? Uncle can’t. — The programmer draws his sword.


2. The Blade

Core Concept: FFmpeg + Shell script, lossless cutting, one swift decapitation.

Design Philosophy:

  • Blade: FFmpeg (professional video processing toolkit)
  • Handle: Shell script automation control
  • Technique: Extract from specified time, lossless copy
  • Effect: Overwrite original file, maintain filename

Simply put, tell FFmpeg: “From the Xth second onwards, I want everything after, throw away all the garbage before.”


3. Forging the Blade

Divine Tool Emerges: mvcut script, simple and brutal, one strike victory.

#!/bin/bash

if [ $# -lt 2 ]; then
  echo "Usage: $0 <video file> <cut time (seconds or 00:02:00)>"
  exit 1
fi

INPUT_PATH="$1"
CUT_TIME="$2"

INPUT_FILE="$(cd "$(dirname "$INPUT_PATH")"; pwd)/$(basename "$INPUT_PATH")"
DIRNAME=$(dirname "$INPUT_FILE")
BASENAME=$(basename "$INPUT_FILE")
EXT="${BASENAME##*.}"
FILENAME="${BASENAME%.*}"
TEMP_FILE="${DIRNAME}/${FILENAME}_cut.${EXT}"

ffmpeg -hide_banner -loglevel error -ss "$CUT_TIME" -i "$INPUT_FILE" -c copy "$TEMP_FILE"

if [ $? -ne 0 ]; then
  echo "Cutting failed: $INPUT_FILE"
  exit 1
fi

rm -f "$INPUT_FILE"
mv "$TEMP_FILE" "$INPUT_FILE"
echo "Done: ${INPUT_FILE}"

Forging Principles:

  • -ss parameter is the blade’s edge, telling FFmpeg where to start cutting
  • -c copy is the blade’s essence, lossless copy, no re-encoding, blazing fast
  • Cut to temporary file first, replace original only on success, avoiding data loss

4. Testing the Blade

Combat Demo: Suppose there’s a movie.mp4 with 2 minutes of garbage ads at the beginning.

Strike! Remove first 120 seconds:

mvcut movie.mp4 120

Another strike! Remove first 2 minutes:

mvcut movie.mp4 00:02:00

Equip for battle:

# Install to home
mkdir -p ~/.local/bin
# Save above code as ~/.local/bin/mvcut

# Grant permissions
chmod +x ~/.local/bin/mvcut

# Add to PATH
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Blade Effects: One cut and the garbage is gone, filename remains the same, clean and efficient. Cut as many seconds as you want, supports time format, cut however you like.


5. Epilogue

This small blade may be short, but it’s effective. I don’t do fancy GUIs or video effects, just a command-line blade, sharp and ruthless enough.

Next time I’ll write about “Batch Beheading” or “End Credits Removal Technique”, continuing the fight for movie “justice”.

Old Programmer’s Code of Honor: Life is short, don’t make intros long.


Alex Hu: Veteran rolling in code piles | 2025-06-07 | Swift Blade Series