A lil' util to help you create a stills generator.
This project is sort of a weird command-line library.
Create your own project and make this a dependency, i.e. npm init && npm install https://github.com/shahkashani/stills.git
For inspiration and example setup, check out the fieriframes bot.
In your own project, you'll need three folders:
videos/
- where the source material will live. Can basically be any video format.stills/
- where all the stills will end upgifs/
- where all the gifs will end up
Below is a list of commands. You'll need ./node_modules/.bin
in your path, or just prepend that to every command.
I usually run these wherever I keep the videos, i.e. my personal computer.
Create stills from videos
folder into stills
folder. Run stills --help
for more info.
If you ran stills --help
, you'll note there's a --faces
options. This will, out of the box, work for faces! If all you care about is any face, then just stop here.
However, if you're looking for specific faces, you're gonna have to train it to detect them. Thankfully, that's super easy.
- In your project, create a
faces
folder. - Make a subfolder and name it to match the person you're training, e.g.
faces/fieri
. Put a bunch of images in here of that person. It does not have to be close-ups, but make sure your person is the only one in the image. - Run
train --name=fieri
. This will create a file calledfaces/fieri.json
. - That's it. Next time you run
stills --faces=10
, it'll make sure 10% of images contain thisfieri
person.
- Put a bunch of SRT files into a folder called
captions
- Run
stills --captions=10
or whatever percentage you want - For 10% of images, this will pick a random caption from one of your SRT files. Bonkers.
Same as stills
, but creates GIFs in a gifs
folder. Run gifs --help
for more info
Upload whatever is in ./gifs
and ./stills
to Dropbox.
If you're posting stills, you'll need the following things in either an .env
file or as environment variables:
DROPBOX_ACCESS_TOKEN=Access token for the Dropbox account the stills live in
DROPBOX_FOLDER=Name of the folder the stills live in, e.g. /stills
TUMBLR_CONSUMER_KEY=Tungle app consumer key
TUMBLR_CONSUMER_SECRET=Tungle app consumer secret
TUMBLR_ACCESS_TOKEN_KEY=Tungle user access token, create this from the API console
TUMBLR_ACCESS_TOKEN_SECRET=Tungle user access token
TUMBLR_BLOG_NAME=Tungle blog name, don't include .tumblr.com
TWITTER_CONSUMER_KEY=Twitter app consumer key
TWITTER_CONSUMER_SECRET=Twitter app consumer secret
TWITTER_ACCESS_TOKEN_KEY=Twitter access token key for the account that'll be doing the tweeting
TWITTER_ACCESS_TOKEN_SECRET=Twitter access token secret for ditto
(You don't have to provide both Tumblr and Twitter keys, skip whichever ones you don't need.)
You're also gonna need to do the following in Dropbox as a one-time step:
- A folder where the stills live, e.g.
/stills
(specify the name in theDROPBOX_FOLDER
field in.env
) - An empty JSON file called
<name>.json
, e.g./stills.json
, where all the posted images will be registered. It'll live at the same level as the folder. Start by just uploading a file with the contents[]
.
OK, now onto the commands. I run these on a cron on Heroku.
Check the connection with Twitter and Dropbox. Good for validating the .env
file.
Connects to Dropbox and posts a still, and updates the JSON file with the image name and the live URL(s).