Created
February 7, 2012 23:30
-
-
Save hrpunio/1762973 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Usage: ffmpeg_cut.sh start-time stop-time file-in file-out | |
# where: | |
# start-time stop-time has the format: hh:mm:ss (hh,mm 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 } ; ## seconds | |
print sec }' | |
} | |
STRT_TIME=`cnt_sec $1` | |
STOP_TIME=`cnt_sec $2` | |
DURATION=$(($STOP_TIME-STRT_TIME)) | |
echo $DURATION | |
ffmpeg -ss $1 -t $DURATION -i $3 $4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment