Update slated_output.bash
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# (c) 2025 Jamie Hardt. All rights reserved.
|
||||
# slated_output.bash
|
||||
# Add slate to the beginning of a movie
|
||||
# by Jamie Hardt
|
||||
# (c) 2025 Squad 51 Inc. All rights reserved.
|
||||
|
||||
# This will add:
|
||||
# - a five-second slate to the beginning of the input movie
|
||||
# - a slate to the beginning of the input movie
|
||||
# - Three thumbnails taken from pre-selected times in the input movie will be
|
||||
# on the slate
|
||||
# - A lower-third text will be printed to the entire length of the outpu
|
||||
@@ -22,16 +25,25 @@ HEADLINE="SOUND DESIGN REVIEW"
|
||||
TITLE="\"TITLE\""
|
||||
CLIENT="CLIENT"
|
||||
CONTACT="CONTACT"
|
||||
PIX_REF="PIC REF"
|
||||
MESSAGE="Sound Design Review $(date +%m/%d)"
|
||||
PIX_REF="PIC_REF"
|
||||
MESSAGE="MESSAGE"
|
||||
|
||||
# Enter the times for each thumbnail here
|
||||
THUMB1_TIME="00:00:30"
|
||||
THUMB2_TIME="00:01:00"
|
||||
THUMB3_TIME="00:02:00"
|
||||
THUMB1_TIME="00:00:37"
|
||||
THUMB2_TIME="00:08:39"
|
||||
THUMB3_TIME="00:11:00"
|
||||
|
||||
# Font for slate titles
|
||||
FONT=:fontfile=/System/Library/Fonts/Helvetica.ttc
|
||||
MESSAGE_COLOR=yellow
|
||||
|
||||
# Enter the slate duration in seconds
|
||||
SLATE_DURATION="1"
|
||||
|
||||
# Set a number here to play a test tone at -20 dBFS under the slate. Don't set
|
||||
# it and the slate will be silent
|
||||
# SLATE_TONE=440
|
||||
|
||||
# Font for slate titles. Leave it unset for the default
|
||||
FONT=/System/Library/Fonts/Avenir.ttc
|
||||
|
||||
# Set this to "-to 20" while you're testing your script out, once it looks
|
||||
# right then set it to ""
|
||||
@@ -39,7 +51,7 @@ OUTPUT_LENGTH_ARG="-to 20"
|
||||
|
||||
# Set this to a positive number to move the middle block, the HEADLINE, TITLE
|
||||
# and CLIENT fields down/south, to avoid covering the thumbnails.
|
||||
MIDDLE_Y_NUDGE="0"
|
||||
MIDDLE_Y_NUDGE="80"
|
||||
|
||||
# Set this to a positive number to move the lower-third and "file" field in
|
||||
# the slate up/north, to avoid covering burnins
|
||||
@@ -51,15 +63,26 @@ BOTTOM_Y_NUDGE="0"
|
||||
#####
|
||||
##### DON'T EDIT BELOW THIS LINE
|
||||
|
||||
|
||||
if [ ! -z $FONT ]; then
|
||||
FONT=":fontfile="$FONT
|
||||
fi
|
||||
|
||||
INPUT_FILE="$1"
|
||||
INPUT_BASENAME=$(basename -- "$INPUT_FILE")
|
||||
OUTPUT_FILE=$(dirname -- "$INPUT_FILE")/"${INPUT_BASENAME%.*}_slated.mov"
|
||||
|
||||
SLATE_AUDIO="-f lavfi -t 5 -i anullsrc=r=48000:cl=stereo,aformat=sample_fmts=s32:channel_layouts=stereo"
|
||||
# SLATE_AUDIO="-f lavfi -t 5 -i sine=440:r=48000,aformat=sample_fmts=s32:channel_layouts=stereo,aeval=val(ch):c=same"
|
||||
SLATE_AUDIO="-f lavfi -t $SLATE_DURATION -i "
|
||||
if [ -z $SLATE_TONE ]; then
|
||||
SLATE_AUDIO+=anullsrc=r=48000:cl=stereo,aformat=sample_fmts=s32:\
|
||||
channel_layouts=stereo
|
||||
else
|
||||
SLATE_AUDIO+="sine=$SLATE_TONE:r=48000,aformat=sample_fmts=s32:"
|
||||
SLATE_AUDIO+="channel_layouts=stereo,aeval=val(ch):c=same"
|
||||
fi
|
||||
|
||||
ffmpeg -y -hide_banner \
|
||||
-f lavfi -i "color=c=black:s=1920x1080:d=5" \
|
||||
-f lavfi -i "color=c=black:s=1920x1080:d=$SLATE_DURATION" \
|
||||
-ss $THUMB1_TIME -i "$INPUT_FILE" \
|
||||
-ss $THUMB2_TIME -i "$INPUT_FILE" \
|
||||
-ss $THUMB3_TIME -i "$INPUT_FILE" \
|
||||
@@ -67,12 +90,11 @@ ffmpeg -y -hide_banner \
|
||||
$SLATE_AUDIO \
|
||||
-filter_complex "
|
||||
[1:v]trim=duration=0.04,setpts=PTS-STARTPTS,scale=560:-1,
|
||||
tpad=stop_mode=clone:stop_duration=5[thumb1];
|
||||
tpad=stop_mode=clone:stop_duration=$SLATE_DURATION[thumb1];
|
||||
[2:v]trim=duration=0.04,setpts=PTS-STARTPTS,scale=560:-1,
|
||||
tpad=stop_mode=clone:stop_duration=5[thumb2];
|
||||
tpad=stop_mode=clone:stop_duration=$SLATE_DURATION[thumb2];
|
||||
[3:v]trim=duration=0.04,setpts=PTS-STARTPTS,scale=560:-1,
|
||||
tpad=stop_mode=clone:stop_duration=5[thumb3];
|
||||
|
||||
tpad=stop_mode=clone:stop_duration=$SLATE_DURATION[thumb3];
|
||||
[0:v][thumb1]overlay=100:100[tmp1];
|
||||
[tmp1][thumb2]overlay=690:100[tmp2];
|
||||
[tmp2][thumb3]overlay=1280:100[slate_raw];
|
||||
@@ -94,7 +116,7 @@ ffmpeg -y -hide_banner \
|
||||
[4:a]aresample=48000,aformat=sample_fmts=s32:channel_layouts=stereo[a1];
|
||||
|
||||
[slate][5:a][v1][a1]concat=n=2:v=1:a=1[vcat][acat];
|
||||
[vcat]drawtext=text='$MESSAGE':fontcolor=white:box=1:boxcolor=black:
|
||||
[vcat]drawtext=text='$MESSAGE':fontcolor=$MESSAGE_COLOR:box=1:boxcolor=black:
|
||||
boxborderw=10:fontsize=42:x=(w-text_w)/2:
|
||||
y=h-(100+$BOTTOM_Y_NUDGE):fontfile=$FONT[outv]
|
||||
" \
|
||||
|
Reference in New Issue
Block a user