/Cookery

bash deep fry script

Primary LanguageShell

COOKERY Cory Arcangel & Henry Van Dusen

A "deep frying" command-line utility which can randomly generate "deep frying" scores, and playback those scores on an image or on the frames of a video file (with optional key-framing!).

Requires imagemagick, realpath, and video support requires FFMPEG.

required args:

  • -f image_file (default: spongebob.jpg)

You can also always add the image file as the last argument without -f

optional args:

  • -n iterations (default: 5)
  • -s save every (default: 1)
  • -h generated recipe filename (default: recipe.txt)
  • -r recipe file to cook with (default: null)
    • must be a recipe file that resulted from cooking
    • -n and -h arguments will be ignored
  • -o output_directory (default: autogenerated based on date/time)
  • -l only generate the last image (default: false. just include -l to turn on)
    • -n argument will be ignored

INSTALLATION:

Run the installation script to add the cook executable to your path:

sudo ./install.sh

USAGE:

cook -o output_folder spongebob.jpg

By default, cooking steps will be saved to a file called recipe.txt. To use a different name, use -h [filename].

When we run

cook -h my_recipe.txt -o output_folder -f spongebob.jpg

we should see these files in output_folder:

my_recipe.txt
spongebob-step-1.jpg
spongebob-step-2.jpg
spongebob-step-3.jpg
spongebob-step-4.jpg
spongebob-step-5.jpg

Here's spongebob-step-5.jpg:

Alt Text

We can reuse output_folder/my_recipe.txt on other images! To replay a recipe file, pass the -r flag to cook:

cook -r output_folder/my_recipe.txt -o output_folder -f mr-krabs.jpg

Here's the resulting mr-krabs-step-5.jpg, cooked with my_recipe.txt:

Alt Text

COOK A VIDEO

cook works with video! Here's how to cook a video at 60 frames per second (the default is 30fps), saving all generated files in the video-output folder:

cook -r recipe.txt -fr 60 -o video-output vid.mp4

This script generates individual frames from the video at the specified framerate, saves cooked versions of each frame following the recipe file into a cooked subfolder, and recombines those frames back into a video called out.mp4 in cooked.

COOKERY DIRECTOR: -d

Instead of using a single recipe file to cook all frames of a video, you can provide a combination of recipe files and specify which frames they apply to using the Cookery Director flag, -d. This points to a director file.

The director file contains one or more lines containing this format:

[starting frame],[required recipe file],[optional recipe file for keyframing]

For example:

1,recipe1.txt
200,recipe2.txt,recipe3.txt
800,recipe3.txt

This file will apply recipe1.txt to frames 1-199. Then from frame 200-799, recipe2.txt will be applied with decreasing strength, while recipe3.txt will be applied with increasing strength. This achieves a keyframe-like effect (!!!!!!!) Then recipe3.txt will be applied from frame 800 to the final frame. Each recipe file is given as its relative path from the director file.

cook -d ./director -fr 60 -o video-output vid.mp4

Hot tip: to see how many frames are in a video, use the -fc flag:

cook -fc vid.mp4
total frames: 150

Published by Arcangel Surfware (SRF-061)