X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/b8f798aa115328694754d1c343127440c270a83f..a9a36cc48e1b18d63c1b1f240c9347191ec8d67f:/unitproc/bktemp-get_media_length?ds=inline diff --git a/unitproc/bktemp-get_media_length b/unitproc/bktemp-get_media_length new file mode 100644 index 0000000..76c8f3d --- /dev/null +++ b/unitproc/bktemp-get_media_length @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +get_media_length() { + # Use ffprobe to get media container length in seconds (float) + # Usage: get_media_length arg1 + # Input: arg1: path to file + # Output: stdout: seconds (float) + # Depends: ffprobe 4.1.8 + # Ref/Attrib: [1] How to get video duration in seconds? https://superuser.com/a/945604 + local file_in + file_in="$1"; + if [[ ! -f $file_in ]]; then + die "ERROR:Not a file:$file_in"; + fi; + ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$file_in"; +} # Get media container length in seconds via stdout + +# Author: Steven Baltakatei Sandoval +# License: GPLv3+ \ No newline at end of file