Skip to content

Resources to scrape Tik Tok videos, extract frames and create strip montages for each video

Notifications You must be signed in to change notification settings

andreabenedetti/tiktok-montage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Download videos from TikTok and create montages

Requirements

  • tiktok-scraper: Scraper to download videos from Tik Tok with various settings (from user, hashtags, sounds...)
  • ffmpeg: Library to manipulate videos through a CLI
  • Python dependencies:
    • pip install numpy
    • pip install Pillow
    • pip install os-sys
    • pip install natsort

Instructions

Install tiktok-scraper through npm

npm install tiktok-scraper

Data gathering

Run tiktok-scraper with your settings, copy the links to the videos and download them (I use DownThemAll on Firefox)

Extracting frames

Once you have your videos, open Terminal and go to the folder where they have been downloaded. Now, copy extract-frames.sh (inside the src folder; it currently runs only on macOS, but it's based on this bat script) to your video directory and run it:

cd /path/to/video/folder
/path/to/video/folder % sh extract-frames.sh

It will create a folder named as each video: it will extract one frame every two seconds.

Montage

Copy stitch.py to the folder of the video you want to create the frametage (frame montage) for.

cd /path/to/frame/folder
/path/to/frame/folder % python stitch.py

The script will generate a horizontal stitching of all the images inside the folder. It will be called as the folder and it will placed in its parent directory.

Example result

Example Video frametage from the hashtag "coronavirus"

Future developments

Implement Google Vision ORC to extract text from the single frames.

Notebook

Isolate hashtags (regex): #[^\s]+, #[^\s"]+ to exclude the content after the " delimitator

Create column of hashtags in OpenRefine (clojure): (apply str (interpose ";" (filter #(contains? #{\# \@} (first %)) (.split value ""))))

About

Resources to scrape Tik Tok videos, extract frames and create strip montages for each video

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published