#!/bin/bash# split.shTIMETABLE="timetable.txt"INPUT="input.mp3"NUM=0
while getopts t:i: option
do
case"${option}"in
t)TIMETABLE=${OPTARG};;
i)INPUT=${OPTARG};;esacdone
while read CMD;do
let NUM=NUM+1
START=$(echo"$CMD" | awk'{printf("00:%s", $1)}')END=$(echo"$CMD" | awk'{printf("00:%s", $3)}')FILENAME=$(printf"%02d"$NUM).$(echo"$CMD" | awk-f filename.awk)
ffmpeg -i"$INPUT"-ss"$START"-t"$END"-acodec copy "$FILENAME"done < "$TIMETABLE"
The default timetable is timetable.txt, and the default input is input.mp3, however, you can specify other files with options -t for timetables and -i for .mp3 files.
And here is the awk script file used in the shell script.
I think all your requirements have been met.
The default timetable is
timetable.txt
, and the default input isinput.mp3
, however, you can specify other files with options-t
for timetables and-i
for .mp3 files.And here is the awk script file used in the shell script.
Big big thank you man.