New post with some pictures :)
This commit is contained in:
37
main-site/scripts/slow-mo-video.sh
Normal file
37
main-site/scripts/slow-mo-video.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$3" ]; then
|
||||
cat <<- EOF
|
||||
Usage: slow-mo.sh /input.mp4 /outputm.mp4 RATE
|
||||
Alternative flags( environment variables ):
|
||||
REMOVE_AUDIO
|
||||
When this is set the audio output is disabled
|
||||
SLOW_RATE
|
||||
2.0 => Half speed
|
||||
3.0 => 3x slower
|
||||
Formula is 1 / RATE => OutputRate
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# If this gets set then we do not create the first clip with audio
|
||||
# Default to having no audio
|
||||
if [ ! -z "$REMOVE_AUDIO" ]; then
|
||||
echo "Audio: DISABLED"
|
||||
FFMPEG_COPY="-c copy -an"
|
||||
else
|
||||
echo "Audio: ENABLED"
|
||||
FFMPEG_COPY="-c:v copy"
|
||||
fi
|
||||
|
||||
# Aliasing input variables
|
||||
input="$1"
|
||||
output="$2"
|
||||
|
||||
SLOW_RATE=2.0
|
||||
LOG="-loglevel error"
|
||||
|
||||
ffmpeg $LOG -y -i "$input" -vf "setpts=$SLOW_RATE*PTS" "$output"
|
||||
|
||||
42
main-site/scripts/trim-video.sh
Normal file
42
main-site/scripts/trim-video.sh
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$3" ]; then
|
||||
cat <<- EOF
|
||||
Usage: trim.sh /path/to/file.mp4 HH:MM:SS[.ms] HH:MM:SS[.ms] [/path/to/output.mp4]
|
||||
NOTE:
|
||||
.ms (miliseconds) are optional and default .000
|
||||
Alternate flags ( environment variables ):
|
||||
REMOVE_AUDIO
|
||||
When this is set audio output is disabled
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
input="$1"
|
||||
start="$2"
|
||||
end="$3"
|
||||
|
||||
# Figure out the output file name
|
||||
out="$(dirname $input)/$(basename -s .mp4 $input).slow.mp4"
|
||||
if [ ! -z "$4" ]; then
|
||||
out="$4"
|
||||
fi
|
||||
|
||||
# Figure out the copy options for audio
|
||||
if [ ! -z "$REMOVE_AUDIO" ]; then
|
||||
echo "Audio: DISABLED"
|
||||
COPY_OPT="-c copy -an"
|
||||
else
|
||||
echo "Audio: ENABLED"
|
||||
COPY_OPT="-c:v copy"
|
||||
fi
|
||||
|
||||
LOG="-loglevel error"
|
||||
|
||||
echo Trimming video
|
||||
ffmpeg $LOG -y -i "$input" -ss "$start" -to "$end" $COPY_OPT "$out"
|
||||
|
||||
echo File here $(pwd)
|
||||
ls -la "$out"
|
||||
Reference in New Issue
Block a user