filmless/scripts/export.sh

30 lines
838 B
Bash
Raw Normal View History

2020-02-11 23:10:37 +00:00
#!/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
2020-02-12 19:52:24 +00:00
VIDEO="${1}"
2020-02-11 23:10:37 +00:00
# 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