Last active
August 27, 2022 18:36
-
-
Save mamemomonga/b9688c180ff78edd8582374e87f8f4c6 to your computer and use it in GitHub Desktop.
オーディオを動画にするスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
# フォントの関係でmacOS専用 | |
if [ -z "${1:-}" ]; then | |
echo "USAGE:" | |
echo " $0 [AUDIO FILE]" | |
echo "" | |
exit 1 | |
fi | |
SRCFILE=$1 | |
DSTFILE=$(perl -E '$_="'$SRCFILE'"; s!\.(.+)$!.mp4!; say') | |
exec ffmpeg \ | |
-f lavfi -y -i color=size=640x360:duration=1:rate=1:color=blue \ | |
-i "$SRCFILE" \ | |
-map 0:v -map 1:a \ | |
-vf "drawtext=fontfile=/System/Library/Fonts/HelveticaNeue.ttc:fontsize=30:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2:text='Audio Only'" \ | |
-ab 160k \ | |
"$DSTFILE" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment