Search through a YouTube video frames for found subimages.
gui.mp4
cli.mp4
Shows you the frame themselves, when they occurred, and saves them.
Initially developed to get the entries of a WatchMojo video - scanning the entire video for the number graphic that's used whenever the entry title is on screen, but as you can see the program can be customized to search for any subimage within any YouTube video.
Tech Used: Python, OpenCV, YouTube API, tkinter
With a provided search image, the program will search through the frames of a YouTube video for the image. It will then show you the frames themselves, when they occurred, and saves them.
Additionally the search frame rate and area can be customized, and an easily be used on any raw video files.
While many optimizations were already made, from not searching every single frame, to allowing searching only a subarea of the video, there may exist better template matching algorithms that could be used aside from the default TM_SQDIFF_NORMED
used in OpenCV.
Much was learned about using OpenCV template matching, efficiently using the YouTube API, and writing reusable code for both a GUI and CLI interface.
python cli.py http://www.youtube.com/watch?v=BBxLDFIgFCY
python cli.py http://youtu.be/BBxLDFIgFCY
python cli.py BBxLDFIgFCY
q
- Don't open any of the frames, only output them
-c
- Ignore cache
-sf=#
- Scan every Nth frame, defaults to 45
-fa=y:y2,x:x2
- Area to search frame for the -fa-nth needle
- Where the top left corner is X=0 and Y=0
python gui.py
- Python 2.7+
- youtube-dl
- opencv
Every image within the needles
folder is a subimage to search for, so you can add as many as you like.