A Python library to embed invisible watermarks into video frames
Project description
Video Invisible Watermark
Video Invisible Watermark is a Python library for embedding invisible watermarks into video frames. The library focuses on embedding messages into the center 100x100 pixel region of video frames, ensuring minimal impact on video quality while maintaining robustness.
Features
- Convert Video to Frames: Extract frames from a video.
- Combine Frames to Video: Reassemble frames back into a video.
- Embed Messages: Embed hidden messages into the center 100x100 region of video frames.
- Extract Messages: Retrieve hidden messages from the center 100x100 region of video frames.
- Robustness: Ensures minimal impact on video quality while maintaining message integrity.
Installation
Install the library using pip:
pip install video_invisible_watermark
Usage
Basic Usage
Convert Video to Frames
from video_invisible_watermark import video_to_frames
video_path = 'input_video.mp4'
frames = video_to_frames(video_path)
Combine Frames to Video
from video_invisible_watermark import frames_to_video
output_path = 'output_video.mp4'
fps = 30 # Frames per second
size = (frames[0].shape[1], frames[0].shape[0]) # Frame size
frames_to_video(frames, output_path, fps, size)
Embed Message into Frames
from video_invisible_watermark import embed_message_to_frames
message = 'This is a hidden message'
frames_with_message = embed_message_to_frames(frames, message)
Extract Message from Frames
from video_invisible_watermark import extract_message_from_frames
extracted_messages = extract_message_from_frames(frames_with_message)
print(extracted_messages)
Complete Example
from video_invisible_watermark import (
video_to_frames,
frames_to_video,
embed_message_to_frames,
extract_message_from_frames
)
# Convert video to frames
video_path = 'input_video.mp4'
frames = video_to_frames(video_path)
# Embed message into frames
message = 'This is a hidden message'
frames_with_message = embed_message_to_frames(frames, message)
# Combine frames to video
output_path = 'output_video.mp4'
fps = 30 # Frames per second
size = (frames[0].shape[1], frames[0].shape[0]) # Frame size
frames_to_video(frames_with_message, output_path, fps, size)
# Extract message from frames
extracted_messages = extract_message_from_frames(frames_with_message)
print(extracted_messages)
Testing
Run tests to ensure everything is working correctly:
python -m unittest discover tests
Project Structure
video-invisible-watermark/
│
├── video_invisible_watermark/
│ ├── __init__.py
│ ├── video_watermark.py
│
├── tests/
│ ├── __init__.py
│ ├── test_video_watermark.py
│
├── README.md
├── setup.py
├── requirements.txt
├── .gitignore
Contributing
Contributions are welcome! Please fork the repository and submit a pull request.
License
This project is licensed under the MIT License.
This README provides an overview of the library, installation instructions, basic usage examples, and details about the project structure and testing. Feel free to customize it further based on your specific requirements and preferences.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file video_invisible_watermark-0.1.1.tar.gz.
File metadata
- Download URL: video_invisible_watermark-0.1.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2864aa939d2421f74ee751aae48ba678c3c708f7664c99738759a9d383fdcfa
|
|
| MD5 |
36f39549a02a12d9515db58aa6ba42a1
|
|
| BLAKE2b-256 |
e50851d105da37b63f232fc192f1efc22cc3d2e3c859952927fb404bc46ea36a
|
File details
Details for the file video_invisible_watermark-0.1.1-py3-none-any.whl.
File metadata
- Download URL: video_invisible_watermark-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c61ed4ad525673d712a250bd90a520c795928c66fab7abc8468dbbe23dac5946
|
|
| MD5 |
5a6b66c6fbb3db9b341a1a44a293a087
|
|
| BLAKE2b-256 |
16bea943c36995920d4d7ffafd271e6ae08a1f92a0ee6c0bf785015ed25efb09
|