Skip to content

VectorJet/Yt-data-encoder-decoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YouTube Data Encoder/Decoder

⚠️ DISCLAIMER: This project is purely an experimental proof-of-concept. Utilizing YouTube for arbitrary data storage may violate their Terms of Service (ToS). Its use for such purposes is highly discouraged. This tool is intended for educational exploration of data encoding and video compression limits.

A toolset to encode any file into a video, upload it to YouTube, and later download and decode it back to the original file.

How It Works

For a detailed technical explanation of the encoding process, block sizes, and how data survives video compression, see HOW_IT_WORKS.md.

Features

  • Encoder: Converts binary data into black-and-white pixel blocks in a video file.
  • Multi-threaded: Optimized with NumPy and Python's ProcessPoolExecutor for high-speed encoding and decoding.
  • Adaptive Block Sizing: Automatically selects the best block size based on file size or detects it from video input.
  • Error Correction: Integrated Reed-Solomon ECC to survive video compression artifacts.
  • Uploader: Uses YouTube Data API v3 to upload the encoded video.
  • Downloader: Uses yt-dlp to retrieve the video from YouTube.
  • Decoder: Extracts the original binary data from the video frames with error recovery.
  • Restorer: Automatically detects the file type and restores the original extension.

Usage

The project now features a unified CLI via main.py.

1. Encoding

Convert a file into a video:

# Uses default block size (16) and all available CPU cores
python main.py encode input.zip output.mp4

# Uses adaptive block sizing and specific number of threads
python main.py encode input.zip output.mp4 --block-size 0 --threads 4

2. Uploading

Upload the video to YouTube:

python main.py upload output.mp4 --title "My Data Backup"

Note: Requires client_secrets.json and one-time OAuth authorization.

3. Downloading

Download your video (using yt-dlp):

yt-dlp https://www.youtube.com/watch?v=VIDEO_ID -o downloaded.mp4

4. Decoding

Extract the data from the video:

# Auto-detects block size if it was encoded with adaptive sizing
python main.py decode downloaded.mp4 retrieved.dat --block-size 0 --threads 8

5. Restoring

Restore the original file format:

python main.py restore retrieved.dat

Requirements

  • Python 3.12+
  • OpenCV (opencv-python)
  • NumPy
  • Google API Client Libraries
  • yt-dlp

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors