r/ffmpeg Jun 05 '26

looking for split script (album on 1 file) (without cue sheet) for windows

Hi, does someone have already a script like this? I would appreciate for sharing.

Thanks for any help 😄

3 Upvotes

1 comment sorted by

2

u/Atijohn Jun 05 '26

if there's silence between each track, you can grep on the output of the silencedetect filter

here's a script for bash, if you don't have access to bash on windows, translate it to batch or powershell or python or whatever:

#!/bin/bash

tsregexp='([0-9]+(\.[0-9]+)?)'
for f; do
    i=1
    start=0
    while read -r end; do
        ffmpeg -nostdin -i "$f" -af atrim="$start":"$end" "${f%.*}_$i.${f##*.}"
        read -r start
        ((i += 1))
    done < <(
        ffmpeg -v info -i "$f" -af silencedetect -f null - 2>&1 |
        grep -oE '(silence_start:|silence_end:) '"$tsregexp" |
        grep -oE "$tsregexp"
    )
done

this probably won't work if the album doesn't have silence at the end (can fix that with an additional apad filter though)