Created
February 13, 2019 16:39
-
-
Save fredmajor/651c4490151f3954d811a103de4733f4 to your computer and use it in GitHub Desktop.
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/local/bin/python3 | |
import glob | |
import subprocess | |
import argparse | |
parser=argparse.ArgumentParser() | |
parser.add_argument('out_file', type=str, help='the output audio file', default='out.mp3') | |
args = parser.parse_args() | |
args = args.__dict__ | |
files=glob.glob("*.mp3") | |
if not files: | |
print('No input files detected. Will exit.') | |
exit(1) | |
files.sort() | |
files_str = '|'.join(files) | |
files_arg = 'concat:{}'.format(files_str) | |
cmd = 'ffmpeg -i "{}" -acodec copy {}'.format(files_arg, args['out_file']) | |
print(cmd) | |
result = subprocess.run(cmd, shell=True) | |
print('done') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment