Last active
May 21, 2019 06:55
-
-
Save ogra/37665d303008e072b699e3a8fa686d90 to your computer and use it in GitHub Desktop.
カレントディレクトリに置いた画像picture.png(ピクセル数は縦横ともに偶数)を使い、カレントディレクトリにあるaudioディレクトリにあるすべてのMP3ファイル(拡張子.mp3)をffmpegで動画に変換して、カレントディレクトリにあるvideoディレクトリにMP4ファイルとして保存するスクリプト
This file contains 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
#!/usr/bin/env bash | |
for filename in ./audio/*.mp3; do | |
outputfile=`echo $filename | sed 's/^\.\/audio\//\.\/video\//' | sed 's/mp3$/mp4/'` | |
ffmpeg \ | |
-loop 1 \ | |
-r 30000/1001 \ | |
-i picture.png -i $filename \ | |
-vcodec libx264 \ | |
-acodec aac -strict experimental -ab 320k -ac 2 -ar 44100 \ | |
-pix_fmt yuv420p \ | |
-shortest \ | |
$outputfile | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ffmpegの使い方は
https://dev.classmethod.jp/etc/ffmpeg-create-movie-by-audio/
を参考にしました。