The following assumes you have ffmpeg
installed on your Mac.
If you need to install it, please use Homebrew.
The settings for encoding for YouTube with ffmpeg can be found here and here.
There is no error checking here. It assumes that there are videos in the folder, and that they have mp4 extensions.
- In Automator, start by creating a Quick Action to accept
FOLDERS
inFINDER
. - Set Value of a Variable to
Path
- Ask for Confirmation to confirm the path being used. (Ignore the mention of the Leader video. This was a later modification.)
- Run Shell Script. The following is the
/bin/bash
script, passing inputas arguments
cd "$1"
for f in ./*.mp4; do echo "file '$f'" >> videos2bmerged.txt; done
file_name=Merged-FINAL.mp4
current_time=$(date "+%Y%m%d-%H%M")
final_filename=$current_time.$file_name
/usr/local/bin/ffmpeg -f concat -safe 0 -i videos2bmerged.txt -c:v libx264 -preset slow -profile:v high -crf 18 -coder 1 -pix_fmt yuv420p -movflags +faststart -g 30 -bf 2 -c:a aac -b:a 384k -profile:a aac_low "tmpVideo-PROCESSING.mp4"
rm videos2bmerged.txt
mv "tmpVideo-PROCESSING.mp4" "$final_filename"
- Display Notification Indicate that the processing is complete.
#automator #ffmpeg #videos #concat #youtube