Add scripts

This commit is contained in:
litter 2020-02-11 18:10:37 -05:00
parent 6c84d25426
commit 43d2034576
3 changed files with 74 additions and 0 deletions

23
scripts/calibration.sh Normal file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# Script to change the generated calibration tif files to
# properly scaled files that is a lossless png. The resulting
# file should be massively smaller--100's of MBs to KBs.
#Requires ImageMagick
#Printer DPI
DPI=1440
#Location of calibration files
CALIBRATION_FILES="../filmless_calibration/*.tif"
echo "Changing calibration files to ${DPI}dpi and converting to .png..."
for f in $CALIBRATION_FILES
do
name=$(basename "$f" .tif)
#echo $name
echo "Converting $f -> ../filmless_calibration/${name}.png..."
convert $f -units PixelsPerInch -density $DPI "../filmless_calibration/${name}.png"
rm $f
done

29
scripts/export.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
WITH_SOUND=true #change to false for a silent film
#changes based on printer DPI, this is for 1440
#check the output of the calibration script
AUDIO_RATE=10296
#Either use the script by passing in a path, ie:
#sh export.sh /path/to/my/video.mov
#or hardcode it by changing VIDEO=${1} to VIDEO=/path/to/my/video.mov
VIDEO=${1}
# change these to directory where you will store your frames and audio
FRAMES_DIR=~/Desktop/frames/
AUDIO_DIR=~/Desktop/audio/
mkdir -p "$FRAMES_DIR"
mkdir -p "$AUDIO_DIR"
echo "Exporting ${VIDEO}..."
rm "${FRAMES_DIR}*.png"
ffmpeg -y -i "${VIDEO}" -f image2 -r 24 "${FRAMES_DIR}image-%04d.png"
if [ "$WITH_SOUND" == "true" ]; then
echo "Exporting audio from ${VIDEO}..."
ffmpeg -y -i "${VIDEO}" -y -acodec pcm_s16le -ac 1 -ar $AUDIO_RATE -ss "$START" -t 15 "${AUDIO_DIR}audio.wav"
fi

22
scripts/pages.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
# Script to properly scale generated page_#.tif files
# to your desired DPI.
#Requires ImageMagick
#Printer DPI, same as in filmless_processing.pde
DPI=1440
#Location of generated pages
PAGE_FILES="~/Desktop/page_*.tif"
echo "Changing calibration files to ${DPI}dpi..."
for f in $PAGE_FILES
do
name=$(basename "$f" .tif)
#echo $name
echo "Converting $f..."
mogrify $f -units PixelsPerInch -density $DPI
rm $f
done