mirror of
https://github.com/notwa/rc
synced 2024-06-01 15:33:07 -07:00
update cutv
This commit is contained in:
parent
209bed34cc
commit
2ed98b5187
7
sh/cutv
7
sh/cutv
|
@ -4,14 +4,17 @@
|
|||
# NO_DASH
|
||||
|
||||
cutv() { ### @-
|
||||
[ $# -le 4 ] || { printf "%s\n" "$0: too many arguments" >&2; return 1; }
|
||||
### (WIP) create a short clip of a long video file.
|
||||
|
||||
argc -ge 2 "$0" "$@" || return
|
||||
argc -le 4 "$0" "$@" || return
|
||||
local nel="${1?missing length parameter}"
|
||||
local f="${2?missing file parameter}"
|
||||
local g="cut."${${f##*/}%.*}".mp4"
|
||||
ffmpeg -hide_banner -i "$f" 2>&1 \
|
||||
| grep Duration \
|
||||
| grep -Eo '[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9]' | awk -F: '{print (($1*60+$2)*60+$3)+$4/100}' | read len
|
||||
[[ "$len" -gt 0 ]] || return 1
|
||||
[ "$len" -gt 0 ] || return 1
|
||||
echo "$g"
|
||||
ffmpeg \
|
||||
-hide_banner -loglevel warning -stats -stats_period 5 \
|
||||
|
|
Loading…
Reference in New Issue
Block a user