diff options
Diffstat (limited to 'tools/video-util.sh')
-rwxr-xr-x | tools/video-util.sh | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/tools/video-util.sh b/tools/video-util.sh index 5c4cfd1..a0388f6 100755 --- a/tools/video-util.sh +++ b/tools/video-util.sh @@ -2,8 +2,9 @@ set -e -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +DIR="$( cd "$( dirname "$(realpath "${BASH_SOURCE[0]}")" )" &> /dev/null && pwd )" PROGNAME="$0" + BOLD=$(tput bold) RST=$(tput sgr0) RED=$(tput setaf 1) @@ -28,7 +29,7 @@ debug() { } echoinfo() { - echo "${CYAN}$@${RST}" + >&2 echo "${CYAN}$@${RST}" } echoerr() { @@ -215,13 +216,24 @@ do_motion() { timecodes="${timecodes[@]}" timecodes=${timecodes// /,} - echo "all timecodes: $timecodes" -} + local output_dir="$(dirname "$input")/motion" + if ! [ -d "$output_dir" ]; then + mkdir "$output_dir" || die "do_motion: mkdir($output_dir) failed" + debug "do_motion: created $output_dir directory" + fi -dvr_scan_fake() { - echo "00:05:06.930,00:05:24.063" + local fragment + while read line; do + fragment=($line) + debug "do_motion: writing fragment start=${fragment[0]} duration=${fragment[1]} filename=$output_dir/${fragment[2]}" + ffmpeg $ffmpeg_args -i "$input" -ss ${fragment[0]} -t ${fragment[1]} -c copy -y "$output_dir/${fragment[2]}" </dev/null + done < <($DIR/process-motion-timecodes.py --source-filename "$input" --timecodes "$timecodes") } +#dvr_scan_fake() { +# echo "00:05:06.930,00:05:24.063" +#} + dvr_scan() { local input="$1" local args= |