Simple Spam Detector for Video

With fast internet connection, video is growing fast as the multimedia entertainment platform. User is not only consume the video but also becoming the content creator. But not all user creating content with a good intent. Some of the user creating content for spamming.

Spam definition is very vary, so I will give my own definition of spam. Spam is the content for driving the other user to visit the site or page of the spammer.

I will share one of the simple way to detect spam using only:

  1. Python
  2. ffmpeg
  3. opencv
  4. terrasect

First, lets create Prober. This class is for detecting video duration and getting the sample of the video frame.

file: app/

Then, we will create helper function for converting the duration from seconds to HH:MM:SS format. And also create helper method for delete the sample picture that generated by the prober.

file: app/

We create the ocr file, by using pyterrasect (the abstraction for terrasect) for detecting the character in picture. We also desaturate the picture first using opencv, because it can improve the alphabeth detection in a picture.

file: app/

After that, we also create the spam text detector. Before we detect, we try to clean all non alphabetical words. And then detecting, is contains either banned words, link, or phone number.

file: app/

And we integrate all in

Example usage:

env python3 -f spam.mkv


  1. Get file location, and define how many frame we want to get
  2. Generate sample frame using prober
  3. Desaturate sample picture using opencv
  4. Detect all character inside using terrasect
  5. Check the parsed character, is it spam or not

Created using python 3.5.2 in Linux Mint 18.3 Sylvia.

Related Posts

Streaming Festival Disrupto Exploration and Experimentation 2020

Streaming Festival Disrupto Exploration and Experimentation 2020

Resiko Berbahaya menggunakan VPN gratisan di Laptopmu!

Resiko Berbahaya menggunakan VPN gratisan di Laptopmu!

Part II — Understanding about RuleChain

Mengenal dasar RxSwift

No Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Januari Spesial: Nonton Drakor Gratis!