If you have PHP installed, make it a script:
TimeDiff.php contents:
<?php // Create datetime objcects $dt1 = new DateTime($argv[1]); $dt2 = new DateTime($argv[2]); // Conver difference to seconds $dt3 = $dt2->format('U') - $dt1->format('U'); // echo $dt3."\n"; $h = (int)($dt3 / 3600); $dt3 %= 3600; $m = (int)($dt3 / 60); $dt3 %= 60; $s = $dt3; // Dump as H:M:S echo $h . ":" . $m . ":" . $s; ?>
audiochop.sh contents:
#!/bin/bash INFILE=$1 START=$2 STOP=$3 OUTFILE=$4 OFFSET=`php TimeDiff.php "$START" "$STOP"` echo "Disecting $INFILE starting from $START to $STOP (duration $OFFSET)" ffmpeg -ss "$START" -t "$OFFSET" -i "$INFILE" "$OUTFILE"
Usage:
./audiochop.sh [input.mp3] [startchop] [stopchop] [output.mp3]
Where [startchop] and [stopchop] are both absolute timestamps from the beginning of the track.
NB: Script(s) may need tweaking depending on platform version etc...
ffmpegdoesn't seem to provide anything else than a start time and a duration. Andmplayerdoesn't either.