Skip to content

Instantly share code, notes, and snippets.

@lordjabez
Created October 21, 2023 01:40
Show Gist options
  • Save lordjabez/b8595260d56909f2d40dde8b566d7651 to your computer and use it in GitHub Desktop.
Save lordjabez/b8595260d56909f2d40dde8b566d7651 to your computer and use it in GitHub Desktop.
Split audio file
#!/usr/bin/env bash
set -e
audio_filename="${1}"
splits_filename="${2}"
x="00:00:00"
z=0
audio_filename=$(basename -- "$1")
ext="${audio_filename##*.}"
audio_filename="${audio_filename%.*}"
initcmd="ffmpeg -nostdin -hide_banner -loglevel error -i $1"
while read y; do
initcmd+=" -ss $x -to $y -c copy ${audio_filename}_$z.$ext"
let "z=z+1"
x=$y
done < "${splits_filename}"
$initcmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment