Skip to content

AlexAgents/VidMark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

VidMark

VidMark

Digital video watermarking tool using DWT-DCT with QIM method.

Release License Python FFmpeg

Russian


πŸ“‹ Table of Contents

πŸ“– About

VidMark is a desktop application for embedding digital watermarks into video files. It utilizes a combination of Discrete Wavelet Transform (DWT) and Discrete Cosine Transform (DCT) with Quantization Index Modulation (QIM) to hide digital signatures that are robust against compression, noise, and filtering.

This project was created as part of a university elective course.

✨ Features

πŸ”’ Embedding

  • DWT-DCT-QIM β€” Embedding in the frequency domain within the LL subband DCT coefficients.
  • Adjustable Intensity β€” Presets: Invisible / Balanced / Robust, or manual delta input.
  • Unique Seed β€” XOR of base seed + UUID + timestamp for enhanced security.
  • Automatic Key Generation β€” A JSON key file is mandatory for extraction.

πŸ” Extraction and Verification

  • Majority Voting β€” Extraction from N uniformly selected frames.
  • Reed-Solomon Codes β€” Data recovery from corrupted bits.
  • CRC-16 Verification β€” Integrity validation after extraction.
  • SYNC Marker β€” Confirmation of watermark presence before parsing.

πŸ§ͺ Attack Resistance Testing

  • 30+ Attack Types β€” Compression, noise, filtering, geometry, color transformations.
  • H.264/H.265 Simulation β€” Real encoding/decoding via FFmpeg.
  • NC/BER/PSNR Metrics β€” Calculated for every attack.
  • CSV Export β€” Save results for analysis.

πŸ“Š Quality Metrics

  • PSNR β€” Peak Signal-to-Noise Ratio.
  • SSIM β€” Structural Similarity Index.
  • NC β€” Normalized Correlation.
  • BER β€” Bit Error Rate.

🎨 Interface

  • macOS-style Light Theme β€” Clean, modern QSS styling.
  • Real-time Preview β€” Side-by-side comparison of original and watermarked frames.
  • Detailed Logging β€” Operation log with timestamps and export capability.
  • Settings Dialog β€” Wavelet/level/block/delta/CRF settings with compatibility tooltips.

πŸ“Έ Screenshots

Click to expand gallery
πŸ“₯ Embedding βš™οΈ Settings
Embedding Settings
βœ… Verification πŸ“€ Extraction
Success Extraction
πŸ§ͺ Attack Test πŸ“‹ Log
Attack Test Logs

πŸ“‹ Requirements

Component Version Purpose
Python 3.9+ Runtime environment.
FFmpeg 4.4+ Video encoding/decoding, audio copying, A/V tag normalization, compression attack simulation (H.264/H.265).
ffprobe (w/ FFmpeg) Extracting video metadata (audio streams, format, duration).
ffplay (w/ FFmpeg) Video preview via ffplay (optional, right-click on preview).

⚠️ FFmpeg is mandatory. VidMark requires ffmpeg, ffprobe, and ffplay in the system PATH. The application will show an error and exit if FFmpeg is not found.

Installing FFmpeg:

Platform Command
Windows Download from ffmpeg.org, add to PATH.
macOS brew install ffmpeg
Ubuntu sudo apt install ffmpeg
Arch sudo pacman -S ffmpeg

πŸš€ Installation

git clone https://github.com/qexela/VidMark.git
cd VidMark

python -m venv venv
source venv/bin/activate      # Linux/macOS
venv\Scripts\activate         # Windows

pip install -r requirements.txt

⚑ Quick Start

  1. Launch:
    ffmpeg -version # check ffmpeg installation
    python main.py
  2. Embedding: Go to "Embedding" tab β†’ Select Video β†’ Enter Text β†’ "Start" β†’ Choose save path. Wait for processing β€” metrics will appear on the preview panel.
  3. Key: ⚠️ Save the .json key file! Extraction is impossible without it.
  4. Extraction: Go to "Extraction" tab β†’ Select Watermarked Video β†’ Select Key File β†’ "Extract & Verify". Result: βœ… CONFIRMED / ⚠️ MISMATCH / ❌ NOT FOUND.

πŸ”¬ Algorithm

graph LR
    Input(Input Frame) --> DWT[DWT Haar]
    DWT --> LL[LL Subband]
    LL --> DCT[DCT 8x8]
    DCT --> QIM{Embed QIM}
    QIM --> IDWT[IDWT]
    IDWT --> Output(Output Frame)
Loading

The key file stores exact embedding parameters, including the scrambling seed. Without it, recovering the watermark is impossible.

πŸ“‚ Project Structure

πŸ“‚ Expand file tree
VidMark/
β”œβ”€β”€ πŸš€ main.py                     # Entry point
β”œβ”€β”€ βš™οΈ config.py                   # Global configuration
β”œβ”€β”€ 🌐 i18n.py                     # Internationalization (EN/RU)
β”œβ”€β”€ πŸ“‹ requirements.txt
β”œβ”€β”€ πŸ“– README.md
β”œβ”€β”€ πŸ“– README.ru.md
β”œβ”€β”€ πŸ“œ LICENSE                     # GPLv3
β”œβ”€β”€ πŸ™ˆ .gitignore
β”‚
β”œβ”€β”€ πŸ“ core/                       # Watermarking algorithms
β”‚   β”œβ”€β”€ πŸ”§ embedder.py             # DWT-DCT-QIM Embedding
β”‚   β”œβ”€β”€ πŸ” extractor.py            # DWT-DCT-QIM Extraction
β”‚   β”œβ”€β”€ πŸ›‘οΈ ecc.py                  # Reed-Solomon codes
β”‚   β”œβ”€β”€ πŸ”€ scrambler.py            # Bit scrambling
β”‚   β”œβ”€β”€ πŸ“¦ payload.py              # Payload formation and parsing
β”‚   β”œβ”€β”€ πŸ“Š metrics.py              # PSNR, SSIM, NC, BER
β”‚   β”œβ”€β”€ πŸ§ͺ attacks.py              # Attack simulator
β”‚   └── πŸ”‘ keyfile.py              # Key file management
β”‚
β”œβ”€β”€ πŸ“ ui/                         # PyQt5 Interface
β”‚   β”œβ”€β”€ 🏠 main_window.py
β”‚   β”œβ”€β”€ πŸ“₯ embed_tab.py
β”‚   β”œβ”€β”€ πŸ“€ extract_tab.py
β”‚   β”œβ”€β”€ πŸ§ͺ attack_tab.py
β”‚   β”œβ”€β”€ πŸ“‹ log_tab.py
β”‚   └── βš™οΈ settings_dialog.py
β”‚
β”œβ”€β”€ πŸ“ workers/                    # Background threads
β”‚   └── πŸ”„ video_worker.py
β”‚
β”œβ”€β”€ πŸ“ utils/                      # Utilities
β”‚   β”œβ”€β”€ 🎬 video_utils.py          # Video I/O, FFmpeg
β”‚   └── πŸ–ΌοΈ image_utils.py          # Image conversion
β”‚
β”œβ”€β”€ πŸ“ assets/
β”‚   β”œβ”€β”€ 🎨 icon.ico
β”‚   └── 🎨 style.qss
β”‚
β”œβ”€β”€ πŸ“ scripts/
β”‚   β”œβ”€β”€ πŸ”¨ builder.py
β”‚   └── 🧹 clean.bat / clean.sh / clean.ps1
β”‚
β”œβ”€β”€ πŸ“ tests/
β”‚   └── πŸ§ͺ test_*.py (10 modules, 30+ tests)
β”‚
└── πŸ“ screenshots/

βš™οΈ Configuration

Intensity Presets

Preset Delta PSNR (Typical) Robustness Application
Invisible 20.0 > 48 dB Lower Proof of authorship
Balanced 35.0 ~44-46 dB Good General use (Default)
Robust 55.0 ~40-43 dB Maximum Aggressive conditions

Wavelet Compatibility

Wavelet Level 1 Level 2 Min. Delta
haar βœ… Excellent ⚠️ Questionable 25+
db2 βœ… Excellent ⚠️ Questionable 30+
db4 ⚠️ Questionable ⚠️ Questionable 40+
bior4.4 ⚠️ Questionable βœ… Excellent 30+
coif2 ❌ Poor ❌ Poor 60+

πŸ§ͺ Testing

pytest tests/ -v
python tests/test_cli.py

πŸ“¦ Build EXE

python scripts/build.py              # Interactive menu
python scripts/build.py --build      # Direct build
python scripts/build.py --build --console  # With console window

🧹 Cleaning Scripts

Scripts to clean the repository from temporary files (caches, build artifacts, etc.).

./scripts/clean.sh          # Linux/macOS
scripts\clean.bat           # Windows CMD
scripts\clean.ps1           # Windows PowerShell

❓ FAQ

Q: Why can't I extract the watermark? A: Incorrect key file, excessive compression (CRF > 28), or geometric distortions (rotation > 2 deg).

Q: Can I embed a watermark into audio? A: No, VidMark works only with the video stream. Audio is copied unchanged.

Q: What happens if I lose the key file? A: The watermark cannot be recovered without the key.

🀝 Contributing

This project was created as a university assignment and is open for educational contributions.

  1. Fork the repository
  2. Create a branch: git checkout -b feature/improvement
  3. Commit: git commit -m 'Add improvement'
  4. Push: git push origin feature/improvement
  5. Open a Pull Request

πŸ™ Acknowledgements


Licensed under GPLv3 β€’ Β© 2026 qexela