General Introduction
VideoSeal is an open source video watermarking tool developed by Facebook Research, designed to provide efficient video watermark embedding and extraction. The tool supports the latest open source models, including pre-trained models, training code, inference code, and evaluation tools, all released under the MIT license.VideoSeal not only supports video watermarking, but also applies to image watermarking, providing a variety of benchmark models (e.g., MBRS, CIN, TrustMark, and WAM) for use, modification, and distribution. The tool is designed with the goal of providing users with a flexible and efficient video protection solution.
Function List
- Video watermark embedding: Embed watermarks into videos to protect video copyrights.
- Video Watermark Extraction: Extract the embedded watermark information from the video.
- Image watermark embedding: Support for embedding watermarks into images.
- Image watermark extraction: Extract the embedded watermark information from the image.
- Pre-trained models: Provides a variety of pre-trained models that users can use directly.
- Training code: Full training code is provided so that users can train their own models as needed.
- Reasoning Code: Provide inference code to facilitate watermark embedding and extraction operations.
- Assessment tools: Provide evaluation tools to help users evaluate the effectiveness of watermark embedding and extraction.
Using Help
Installation process
- Installing Python: Ensure that Python version 3.10 is installed on your system.
- Installing PyTorch: Install PyTorch and its dependencies using the following commands:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
- Install VideoSeal: Clone the VideoSeal repository and install the dependencies:
git clone https://github.com/facebookresearch/videoseal.git
cd videoseal
pip install -e .
- Installation of Decord (optional): Library for video processing, recommended installation:
pip install decord
Usage Process
Video watermark embedding
- Load Video: Use torchvision to load and normalize the video:
import torchvision
import videoseal
from videoseal.evals.metrics import bit_accuracy
video_path = "assets/videos/1.mp4"
video = torchvision.io.read_video(video_path, output_format="TCHW")
video = video.float() / 255.0
- Loading Models: Load the VideoSeal model:
model = videoseal.load("videoseal")
- Embedded watermarks: Embed the watermark in the video:
outputs = model.embed(video, is_video=True)
video_w = outputs["imgs_w"]
msgs = outputs["msgs"]
Video Watermark Extraction
- Extract watermark information: Extract embedded information from watermarked videos:
msg_extracted = model.extract_message(video_w, aggregation="avg", is_video=True)
Image watermark embedding and extraction
- Load Image: Load and normalize the image:
img = video[0:1]
outputs = model.embed(img, is_video=False)
img_w = outputs["imgs_w"]
msg_extracted = model.extract_message(img_w, aggregation="avg", is_video=False)
Other Functions
- Pre-training model download: Models are automatically downloaded via Hugging Face, or you can manually download and update the model path.
- Benchmark Model Download: A download guide is provided and the user has to manually download the third-party model.
- VMAF Assessment: Provides VMAF installation and usage guides to help users evaluate video quality.