Advertisement
julian_hughes

adjust cropdetect skip interval according to video duration

Jul 8th, 2012
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.68 KB | None | 0 0
  1. #GET CROPVALUE
  2. if [ ! $fflag ]; then
  3.     #cropdetect runs 10 passes at X seconds intervals. it will fail if
  4.     #interval secs x passes exceeds video duration so set short interval
  5.     #for videos shorter than 30 mins & set long interval for others.
  6.     ffmpeg -i "$i" 2>$FINFO
  7.     DUR=$(grep -m 1 -e Duration $FINFO|awk -F ": " '{print $2}'|\
  8.     awk -F ", " '{print $1}' |awk '{ split($1, A, ":"); print 3600*A[1] + 60*A[2] + A[3] }')
  9.     DUR=$(printf %.0f\\n $DUR)
  10.         if [ $DUR -lt 1800 ]; then
  11.         SECS=15
  12.         else
  13.         SECS=180
  14.         fi
  15.     cropdetect
  16.     else CROP=""
  17.     ffprobe -show_streams "$i" &>$FINFO
  18.     #WIDTH is needed if picture is to be scaled
  19.     WIDTH=$(grep width $FINFO|awk -F "=" '{print $2}')
  20. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement