As simple as:
ffmpeg -ss start-time -t duration -i file-in file-out
Usually start-time/stop-time are given so duration have to be computed. Nothing difficult but the following bash script calculates duration for us:
#!/bin/bash # cnt_sec function converts string `hh:mm:ss' to seconds, both # `hh' and `mm' are optional function cnt_sec () { echo $1 | awk -F":" '{ if (NF>2) { sec += 60*60 * $(NF-2) } ; if (NF>1) { sec += 60 * $(NF-1) } ; if (NF>0) { sec += $NF } ; print sec }' } STRT_TIME=`cnt_sec $1` STOP_TIME=`cnt_sec $2` DURATION=$((STOP_TIME-STRT_TIME)) echo $DURATION # cut from file $3 from $1 to $2 write to $4 # both $1 and $2 are time durations in `hh:mm:ss' format ffmpeg -ss $1 -t $DURATION -i $3 $4