Created
October 8, 2018 13:34
-
-
Save akx/6c7897baf200116e74e6187ffb87e371 to your computer and use it in GitHub Desktop.
play all the music???
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
import subprocess | |
import random | |
pth = "/Users/akx/Music" | |
files = subprocess.check_output('gfind "%s" -name \'*.mp3\'' % pth, shell=True).splitlines() | |
random.shuffle(files) | |
files = files[:10] | |
cmd = [ | |
'ffmpeg', | |
] | |
for file in files: | |
cmd.extend(['-i', file]) | |
cmd.extend([ | |
'-filter_complex', | |
'amix=inputs=%d:duration=longest:dropout_transition=3,dynaudnorm=m=10:f=100' % len(files), | |
'-ac', '2', | |
'-y', | |
'-map_metadata', '-1', | |
'./all-the-music.wav', | |
]) | |
subprocess.check_call(cmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment