Skip to content

Instantly share code, notes, and snippets.

@akx
Created October 8, 2018 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akx/6c7897baf200116e74e6187ffb87e371 to your computer and use it in GitHub Desktop.
Save akx/6c7897baf200116e74e6187ffb87e371 to your computer and use it in GitHub Desktop.
play all the music???
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