this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

vid2gif: add fps option and fix errors for missing start and duration

yemou 644e2637 c623c2ae

+8 -10
+8 -10
scritps/vid2gif
··· 4 4 "\noptions:" \ 5 5 "\t-S TIMESTAMP - timestamp to start the gif" \ 6 6 "\t-d SECONDS - how long the gif should be" \ 7 + "\t-f FPS - framerate of the gif" \ 7 8 "\t-o FILE - output file (default: out.gif)" \ 8 9 "\t-s SCALE - border size (default: 1)" 9 10 } ··· 24 25 case $arg in 25 26 S ) VID2GIF_START=$1; shift ;; 26 27 d ) VID2GIF_DURATION=$1; shift ;; 28 + f ) VID2GIF_FPS=$1; shift ;; 27 29 h ) usage; exit 0 ;; 28 30 i ) VID2GIF_INPUT_FILE=$1; shift ;; 29 31 o ) VID2GIF_OUTPUT_FILE=$1; shift ;; ··· 41 43 usage 1>&2; exit 1 42 44 } 43 45 44 - start= 45 - duration= 46 - [ -n "$VID2GIF_START" ] && start="-ss" 47 - [ -n "$VID2GIF_DURATION" ] && duration="-t" 46 + fps= 47 + [ -n "$VID2GIF_FPS" ] && fps="fps=$VID2GIF_FPS," 48 48 49 49 : "${VID2GIF_SCALE:=1}" 50 50 : "${VID2GIF_OUTPUT_FILE:=out.gif}" 51 51 52 - filters="scale=iw*${VID2GIF_SCALE}:-1:flags=lanczos" 52 + filters="${fps}scale=iw*${VID2GIF_SCALE}:-1:flags=lanczos" 53 53 palette_file=$(mktemp --tmpdir XXX.png) 54 54 55 55 ffmpeg -hide_banner -loglevel warning \ 56 - "$start" "$VID2GIF_START" \ 57 - "$duration" "$VID2GIF_DURATION" \ 56 + ${VID2GIF_START:+"-ss" "$VID2GIF_START"} ${VID2GIF_DURATION:+"-t" "$VID2GIF_DURATION"} \ 58 57 -i "$VID2GIF_INPUT_FILE" -vf "$filters,palettegen" -update true \ 59 - -y "$palette_file" 58 + -y "$palette_file" && \ 60 59 ffmpeg -hide_banner -loglevel warning \ 61 - "$start" "$VID2GIF_START" \ 62 - "$duration" "$VID2GIF_DURATION" \ 60 + ${VID2GIF_START:+"-ss" "$VID2GIF_START"} ${VID2GIF_DURATION:+"-t" "$VID2GIF_DURATION"} \ 63 61 -i "$VID2GIF_INPUT_FILE" -i "$palette_file" -filter_complex "$filters,paletteuse" \ 64 62 "$VID2GIF_OUTPUT_FILE" 65 63