Skip to content

Instantly share code, notes, and snippets.

@1d10t
Created November 23, 2018 16:03
Show Gist options
  • Save 1d10t/0433da549a9321f7bcb59b1707f86021 to your computer and use it in GitHub Desktop.
Save 1d10t/0433da549a9321f7bcb59b1707f86021 to your computer and use it in GitHub Desktop.
pack directory-separated arrays of mp3 pieces to a big mp3s
php -r "foreach(glob('./*/') as $d){ $dn=basename($d); $a=glob($d.'*.mp3'); natsort($a); var_dump($dn, $a); $asize=array_sum(array_map('filesize',$a)); $rf=$dn.'-ffccat.mp3'; $lf=$dn.'.txt'; if(file_exists($rf)&&filesize($rf)>=$asize) continue; foreach($a as $i => $f) file_put_contents($lf, \"file '$f'\n\", $i ? FILE_APPEND : null); passthru('c:/ffmpeg/ffmpeg-20181015-c27c7b4-win64-static/bin/ffmpeg -f concat -safe 0 -i '.escapeshellarg($lf).' -c copy '.escapeshellarg($rf)); }"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment