Jika Anda menginstal PHP, buat skrip:
Isi TimeDiff.php:
<?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;
?>
konten audiochop.sh:
#!/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"
Pemakaian:
./audiochop.sh [input.mp3] [startchop] [stopchop] [output.mp3]
Di mana [startchop] dan [stopchop] adalah cap waktu absolut dari awal trek.
NB: Script mungkin perlu diubah tergantung pada versi platform dll ...