Created
June 28, 2024 05:10
-
-
Save YKamataki/a5c519e6c3d58e7baba257bd3a678a5a to your computer and use it in GitHub Desktop.
AAC mix w/ ffmpeg
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/python3 | |
""" | |
カレントディレクトリ内のAACファイルをミックスします。 | |
シングルトラックで録音されたデータをまとめる用です。 | |
全てのトラックが同じ長さであることが前提です。 | |
ffmpegは、ご自身でイストールしてください。 | |
""" | |
import os | |
import glob | |
import datetime | |
# AACファイルの一覧を取得 | |
files = glob.glob("./*.aac") | |
# コマンドを作成 | |
cmd = "ffmpeg" | |
for path in files: | |
cmd += f" -i {path}" | |
cmd += f" -filter_complex \"amix=inputs={len(files)}:duration=longest\"" | |
filename = datetime.date.today().strftime("%Y-%M-%d") + ".aac" | |
cmd += f" {filename}" | |
print("COMMAND:\n",cmd) | |
input("ENTERで続行、^Cでキャンセル") | |
os.system(cmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment