Giter VIP home page Giter VIP logo

watermarkremover's Introduction

WatermarkRemover

通过手动框选区域去除视频中位置固定的水印和字幕,项目基于Python3.7。

效果

  • 原始帧
  • 去除水印
  • 去除字幕

如何使用

1. 安装依赖:

pip install -r requirements.txt

2. 运行程序

待处理视频放在video文件夹下,所有视频尺寸须保持一致,鼠标框选水印或字幕对应区域后按SPACEENTER

  • 函数调用示例
#去除视频水印
remover = WatermarkRemover(threshold=80, kernel_size=5)
remover.remove_video_watermark(video_path)

#去除视频字幕
remover = WatermarkRemover(threshold=80, kernel_size=10)
remover.remove_video_subtitle(video_path)
Param Description
threshold 阈值分割灰度值,范围0~255,根据水印灰度值自行调整
kernel_size 膨胀运算核尺寸,范围所有正整数,用于处理水印或字幕边缘
  • 输出 去除水印:output/[文件名] + [_no_watermark].mp4 去除字幕:output/[文件名] + [_no_sub].mp4

流程图

  • 去除水印
    graph LR
    ROI[框选水印] --> SINGLE_MASK[截取若干帧生成对应模板]
    SINGLE_MASK -->|逻辑与运算|MASK[最终水印模板]
    MASK --> FRAME[读取视频]
    FRAME --> AUDIO[抽取音频] 
    FRAME --> INPAINT[TELEA算法逐帧修复]
    INPAINT --> VIDEO[逐帧写入视频]
    AUDIO --> OUTPUT
    VIDEO --> OUTPUT[合并封装输出视频]
    
  • 去除字幕
    graph LR
    ROI[框选字幕] --> FRAME[读取视频]
    FRAME --> MASK[生成单帧图像模板]
    FRAME --> AUDIO[抽取音频]
    MASK --> INPAINT[TELEA算法逐帧修复]
    INPAINT --> VIDEO[逐帧写入视频]
    VIDEO --> OUTPUT[合并封装输出视频]
    AUDIO --> OUTPUT
    

watermarkremover's People

Contributors

lxulxu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.