summaryrefslogtreecommitdiff
path: root/bin/split-media-files.sh
blob: c68062981e4f4f70fd5149b83d84395a978b729d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
max_duration=$((4*3600))

if [[ $# -ne 1 ]]; then
    echo 1>&2 "Usage: $0 <media-file>"
    exit 1
fi

input_file="$1"

base="$(basename $input_file | perl -pe 's/(.*)\.([^.]*)$/$1/')"

ffmpeg -i "${input_file}" \
       -f segment -segment_time $max_duration -segment_start_number 1 \
       -segment_format mp3 -qscale:a 5 \
       "${base}-%02d.mp3"