Update files
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
:: Description: Video to GIF/APNG/WEBP converter
|
||||
:: By: MDHEXT, Nabi KaramAliZadeh, Pathduck
|
||||
:: Version: 6.0
|
||||
:: Url: https://github.com/Pathduck/vid2ani/ forked from https://github.com/MDHEXT/video2gif
|
||||
:: What this script is based on: http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
|
||||
:: Url: https://github.com/Pathduck/vid2ani/
|
||||
:: License: GNU General Public License v3.0 (GPLv3)
|
||||
|
||||
:: Enable delayed variable expension
|
||||
@@ -17,73 +16,69 @@ SET "YELLOW=[33m"
|
||||
SET "BLUE=[94m"
|
||||
SET "CYAN=[96m"
|
||||
|
||||
:: Clearing all variables
|
||||
SET "scale="
|
||||
SET "fps="
|
||||
SET "mode="
|
||||
SET "dither="
|
||||
SET "bayerscale="
|
||||
SET "filetype="
|
||||
SET "start_time="
|
||||
SET "end_time="
|
||||
SET "webp_lossy="
|
||||
SET "colormax="
|
||||
SET "version="
|
||||
SET "build="
|
||||
SET "loglevel="
|
||||
:: Checking for blank input or help commands
|
||||
IF "%~1" == "" GOTO :help_message
|
||||
IF "%~1" == "-?" GOTO :help_message
|
||||
IF "%~1" == "/?" GOTO :help_message
|
||||
IF "%~1" == "--help" GOTO :help_message
|
||||
|
||||
:: Check input
|
||||
:: Assign input and output
|
||||
SET input="%~1"
|
||||
SET output=%~dpn1
|
||||
|
||||
:: Setting the path to the Working Directory
|
||||
:: Validate input file
|
||||
IF NOT EXIST %input% (
|
||||
ECHO %RED%Input file not found: %input%%OFF%
|
||||
GOTO :EOF
|
||||
)
|
||||
|
||||
:: Setting the path to the working directory
|
||||
SET WD=%TEMP%\VID2ANI
|
||||
|
||||
:: Checking for blank input or help commands
|
||||
IF %input% == "" GOTO :help_message
|
||||
IF %input% == "-?" GOTO :help_message
|
||||
IF %input% == "/?" GOTO :help_message
|
||||
IF %input% == "help" GOTO :help_message
|
||||
IF %input% == "--help" GOTO :help_message
|
||||
:: Clearing input vars and setting defaults
|
||||
SET "fps=15"
|
||||
SET "mode=1"
|
||||
SET "dither=0"
|
||||
SET "scale=-1"
|
||||
SET "filetype=gif"
|
||||
SET "webp_lossy="
|
||||
SET "webp_lossy_def=75"
|
||||
SET "loglevel=error"
|
||||
SET "bayerscale="
|
||||
SET "colormax="
|
||||
SET "start_time="
|
||||
SET "end_time="
|
||||
SET "errorswitch="
|
||||
SET "picswitch="
|
||||
|
||||
GOTO :varin
|
||||
|
||||
:varin
|
||||
:: Using SHIFT command to go through the input and storing each setting into its own variable
|
||||
IF NOT "%~1" =="" (
|
||||
IF "%~1" =="-r" SET "scale=%~2" & SHIFT
|
||||
IF "%~1" =="-f" SET "fps=%~2" & SHIFT
|
||||
IF "%~1" =="-m" SET "mode=%~2" & SHIFT
|
||||
IF "%~1" =="-d" SET "dither=%~2" & SHIFT
|
||||
IF "%~1" =="-b" SET "bayerscale=%~2" & SHIFT
|
||||
IF "%~1" =="-t" SET "filetype=%~2" & SHIFT
|
||||
IF "%~1" =="-o" SET "output=%~dpn2" & SHIFT
|
||||
IF "%~1" =="-t" SET "filetype=%~2" & SHIFT
|
||||
IF "%~1" =="-r" SET "scale=%~2" & SHIFT
|
||||
IF "%~1" =="-l" ( IF 1%2 NEQ +1%~2 ( SET "webp_lossy=%webp_lossy_def%"
|
||||
) ELSE IF "%~2" == "" ( SET "webp_lossy=%webp_lossy_def%"
|
||||
) ELSE ( SET "webp_lossy=%~2" & SHIFT )
|
||||
)
|
||||
IF "%~1" =="-f" SET "fps=%~2" & SHIFT
|
||||
IF "%~1" =="-s" SET "start_time=%~2" & SHIFT
|
||||
IF "%~1" =="-e" SET "end_time=%~2" & SHIFT
|
||||
IF "%~1" =="-d" SET "dither=%~2" & SHIFT
|
||||
IF "%~1" =="-b" SET "bayerscale=%~2" & SHIFT
|
||||
IF "%~1" =="-m" SET "mode=%~2" & SHIFT
|
||||
IF "%~1" =="-c" SET "colormax=%~2" & SHIFT
|
||||
IF "%~1" =="-l" SET "webp_lossy=%~2" & SHIFT
|
||||
IF "%~1" =="-v" SET "loglevel=%~2" & SHIFT
|
||||
IF "%~1" =="-k" SET "errorswitch=1"
|
||||
IF "%~1" =="-p" SET "picswitch=1"
|
||||
SHIFT & GOTO :varin
|
||||
)
|
||||
GOTO :help_check_2
|
||||
|
||||
:help_check_2
|
||||
:: Noob proofing the script to prevent it from breaking should critical settings not be defined
|
||||
IF NOT DEFINED scale SET "scale=-1"
|
||||
IF NOT DEFINED fps SET "fps=15"
|
||||
IF NOT DEFINED mode SET "mode=1"
|
||||
IF NOT DEFINED dither SET "dither=0"
|
||||
IF NOT DEFINED filetype SET "filetype=gif"
|
||||
IF NOT DEFINED loglevel SET "loglevel=error"
|
||||
|
||||
GOTO :safchek
|
||||
|
||||
:safchek
|
||||
:: Setting a clear range of acceptable setting values and noob proofing bayerscale
|
||||
|
||||
:: Output file type
|
||||
:: Validate output file extension
|
||||
echo %filetype% | findstr /r "\<gif\> \<png\> \<apng\> \<webp\>" >nul
|
||||
IF %errorlevel% NEQ 0 (
|
||||
ECHO %RED%Not a valid file type: %filetype%%OFF%
|
||||
@@ -95,19 +90,19 @@ IF "%filetype%"=="apng" SET "output=%output%.png"
|
||||
IF "%filetype%"=="webp" SET "output=%output%.webp"
|
||||
|
||||
:: Validate Palettegen
|
||||
IF %mode% GTR 3 (
|
||||
IF !mode! GTR 3 (
|
||||
ECHO %RED%Not a valid palettegen ^(-m^) mode%OFF%
|
||||
GOTO :EOF
|
||||
) ELSE IF %mode% LSS 1 (
|
||||
) ELSE IF !%mode! LSS 1 (
|
||||
ECHO %RED%Not a valid palettegen ^(-m^) mode%OFF%
|
||||
GOTO :EOF
|
||||
)
|
||||
|
||||
:: Validate Dithering
|
||||
IF %dither% GTR 8 (
|
||||
IF !dither! GTR 8 (
|
||||
ECHO %RED%Not a valid dither ^(-d^) algorithm %OFF%
|
||||
GOTO :EOF
|
||||
) ELSE IF %dither% LSS 0 (
|
||||
) ELSE IF !dither! LSS 0 (
|
||||
ECHO %RED%Not a valid dither ^(-d^) algorithm%OFF%
|
||||
GOTO :EOF
|
||||
)
|
||||
@@ -121,7 +116,7 @@ IF DEFINED bayerscale (
|
||||
ECHO %RED%Not a valid bayerscale ^(-b^) value%OFF%
|
||||
GOTO :EOF
|
||||
)
|
||||
IF %dither% NEQ 1 (
|
||||
IF !dither! NEQ 1 (
|
||||
IF !bayerscale! LEQ 5 (
|
||||
ECHO %RED%Bayerscale ^(-b^) only works with Bayer dithering%OFF%
|
||||
GOTO :EOF
|
||||
@@ -151,8 +146,8 @@ IF DEFINED start_time (
|
||||
GOTO :EOF
|
||||
)
|
||||
)
|
||||
IF NOT DEFINED start_time (
|
||||
IF DEFINED end_time (
|
||||
IF DEFINED end_time (
|
||||
IF NOT DEFINED start_time (
|
||||
ECHO %RED%Please input the start time ^(-s^)%OFF%
|
||||
GOTO :EOF
|
||||
)
|
||||
@@ -168,11 +163,11 @@ IF DEFINED fps (
|
||||
|
||||
:: Validate Max Colors
|
||||
IF DEFINED colormax (
|
||||
IF !colormax! LSS 3 (
|
||||
IF !colormax! GTR 256 (
|
||||
ECHO %RED%Max colors ^(-c^) must be between 3 and 256.%OFF%
|
||||
GOTO :EOF
|
||||
)
|
||||
IF !colormax! GTR 256 (
|
||||
IF !colormax! LSS 3 (
|
||||
ECHO %RED%Max colors ^(-c^) must be between 3 and 256.%OFF%
|
||||
GOTO :EOF
|
||||
)
|
||||
@@ -204,21 +199,21 @@ SET filters=fps=%fps%,scale=%scale%:-1:flags=lanczos
|
||||
|
||||
:: APNG muxer does not support multiple palettes so fallback to using palettegen diff mode
|
||||
IF "%filetype%"=="apng" (
|
||||
IF %mode% EQU 2 (
|
||||
IF !mode! EQU 2 (
|
||||
ECHO %YELLOW%APNG does not support multiple palettes - falling back to Palettegen mode 1 ^(diff^)%OFF%
|
||||
SET mode=1
|
||||
)
|
||||
)
|
||||
|
||||
:: Palettegen encode mode
|
||||
IF %mode% EQU 1 SET "encode=palettegen=stats_mode=diff"
|
||||
IF %mode% EQU 2 SET "encode=palettegen=stats_mode=single"
|
||||
IF %mode% EQU 3 SET "encode=palettegen"
|
||||
IF !mode! EQU 1 SET "encode=palettegen=stats_mode=diff"
|
||||
IF !mode! EQU 2 SET "encode=palettegen=stats_mode=single"
|
||||
IF !mode! EQU 3 SET "encode=palettegen"
|
||||
|
||||
:: Max colors
|
||||
IF DEFINED colormax (
|
||||
IF %mode% LEQ 2 SET "mcol=:max_colors=%colormax%"
|
||||
IF %mode% EQU 3 SET "mcol==max_colors=%colormax%"
|
||||
IF !mode! LEQ 2 SET "mcol=:max_colors=%colormax%"
|
||||
IF !mode! EQU 3 SET "mcol==max_colors=%colormax%"
|
||||
)
|
||||
|
||||
:: Executing command to generate palette
|
||||
@@ -228,37 +223,37 @@ ffmpeg -v %loglevel% %trim% -i %input% -vf "%filters%,%encode%%mcol%" -y "%palet
|
||||
|
||||
:: Checking if the palette file is in the Working Directory, if not cleaning up
|
||||
IF NOT EXIST "%WD%\palette_00001.png" (
|
||||
ECHO %RED%Failed to generate palette file%OFF%
|
||||
ECHO %RED%Palette generation failed: %palette% not found.%OFF%
|
||||
GOTO :cleanup
|
||||
)
|
||||
|
||||
:: Setting variables to put the encode command together
|
||||
|
||||
:: Palettegen decode mode
|
||||
IF %mode% EQU 1 SET "decode=paletteuse"
|
||||
IF %mode% EQU 2 SET "decode=paletteuse=new=1"
|
||||
IF %mode% EQU 3 SET "decode=paletteuse"
|
||||
IF !mode! EQU 1 SET "decode=paletteuse"
|
||||
IF !mode! EQU 2 SET "decode=paletteuse=new=1"
|
||||
IF !mode! EQU 3 SET "decode=paletteuse"
|
||||
|
||||
:: Error diffusion
|
||||
IF DEFINED errorswitch (
|
||||
IF %mode% EQU 1 SET "errordiff==diff_mode=rectangle"
|
||||
IF %mode% EQU 2 SET "errordiff=:diff_mode=rectangle"
|
||||
IF %mode% EQU 3 SET "errordiff==diff_mode=rectangle"
|
||||
IF !mode! EQU 1 SET "errordiff==diff_mode=rectangle"
|
||||
IF !mode! EQU 2 SET "errordiff=:diff_mode=rectangle"
|
||||
IF !mode! EQU 3 SET "errordiff==diff_mode=rectangle"
|
||||
)
|
||||
|
||||
:: Prepare dithering and encoding options
|
||||
IF %dither% EQU 0 SET "ditheralg=none"
|
||||
IF %dither% EQU 1 SET "ditheralg=bayer"
|
||||
IF %dither% EQU 2 SET "ditheralg=heckbert"
|
||||
IF %dither% EQU 3 SET "ditheralg=floyd_steinberg"
|
||||
IF %dither% EQU 4 SET "ditheralg=sierra2"
|
||||
IF %dither% EQU 5 SET "ditheralg=sierra2_4a"
|
||||
IF %dither% EQU 6 SET "ditheralg=sierra3"
|
||||
IF %dither% EQU 7 SET "ditheralg=burkes"
|
||||
IF %dither% EQU 8 SET "ditheralg=atkinson"
|
||||
IF !dither! EQU 0 SET "ditheralg=none"
|
||||
IF !dither! EQU 1 SET "ditheralg=bayer"
|
||||
IF !dither! EQU 2 SET "ditheralg=heckbert"
|
||||
IF !dither! EQU 3 SET "ditheralg=floyd_steinberg"
|
||||
IF !dither! EQU 4 SET "ditheralg=sierra2"
|
||||
IF !dither! EQU 5 SET "ditheralg=sierra2_4a"
|
||||
IF !dither! EQU 6 SET "ditheralg=sierra3"
|
||||
IF !dither! EQU 7 SET "ditheralg=burkes"
|
||||
IF !dither! EQU 8 SET "ditheralg=atkinson"
|
||||
|
||||
:: Paletteuse error diffusion
|
||||
IF NOT %mode% EQU 2 (
|
||||
IF NOT !mode! EQU 2 (
|
||||
IF DEFINED errorswitch SET "ditherenc=:dither=!ditheralg!"
|
||||
IF NOT DEFINED errorswitch SET "ditherenc==dither=!ditheralg!"
|
||||
) ELSE SET "ditherenc=:dither=!ditheralg!"
|
||||
@@ -281,11 +276,11 @@ ffmpeg -v %loglevel% %trim% -i %input% -thread_queue_size 512 -i "%palette%" -la
|
||||
|
||||
:: Checking if file was created and cleaning up if not
|
||||
IF NOT EXIST "%output%" (
|
||||
ECHO %RED%Failed to generate animation%OFF%
|
||||
ECHO %RED%Failed to generate animation: %output% not found.%OFF%
|
||||
GOTO :cleanup
|
||||
)
|
||||
|
||||
:: Starting default Photo Viewer
|
||||
:: Open output file if picswitch is set
|
||||
IF DEFINED picswitch START "" "%output%"
|
||||
|
||||
:cleanup
|
||||
@@ -306,22 +301,22 @@ ECHO %GREEN%Usage:%OFF%
|
||||
ECHO %~nx0 [input_file] [arguments]
|
||||
ECHO:
|
||||
ECHO %GREEN%Arguments:%OFF%
|
||||
ECHO -o Output file. Default is the same as input file, sans extension.
|
||||
ECHO -t Output file type. Valid: 'gif' (default), 'apng', 'png', 'webp'.
|
||||
ECHO -o Output file. The default is the same name as the input video.
|
||||
ECHO -r Scale or size. Width of the animation in pixels.
|
||||
ECHO -l Enable lossy WebP compression and quality. Range 0-100, default 75.
|
||||
ECHO -f Framerate in frames per seconds, default 15.
|
||||
ECHO -s Start time of the animation (HH:MM:SS.MS).
|
||||
ECHO -e End time of the animation (HH:MM:SS.MS).
|
||||
ECHO -f Framerate in frames per second (default: 15).
|
||||
ECHO -d Dithering algorithm to be used (default: 0).
|
||||
ECHO -b Bayer Scale setting. Range 0 - 5 (default: 2).
|
||||
ECHO -m Palettegen mode: 1 (diff), 2 (single), 3 (full) (default: 1).
|
||||
ECHO -c Maximum colors usable per palette. Range 3 - 256 (default).
|
||||
ECHO -d Dithering algorithm to be used, default 0.
|
||||
ECHO -b Bayer Scale setting. Range 0-5, default 2.
|
||||
ECHO -m Palettegen mode: 1 (diff), 2 (single), 3 (full), default 1.
|
||||
ECHO -c Maximum colors usable per palette. Range 3-256 (default).
|
||||
ECHO -k Enables paletteuse error diffusion.
|
||||
ECHO -l Enable lossy WebP compression and quality. Range 0 - 100.
|
||||
ECHO -p Opens the resulting animation in the default image viewer.
|
||||
ECHO -v Set FFmpeg log level (default: error).
|
||||
ECHO -p Opens the resulting animation in the default viewer.
|
||||
ECHO:
|
||||
ECHO %GREEN%Dithering Mode%OFF%
|
||||
ECHO %GREEN%Dithering Algorithms%OFF%
|
||||
ECHO 0: None
|
||||
ECHO 1: Bayer
|
||||
ECHO 2: Heckbert
|
||||
|
||||
161
Batch/vid2ani.sh
161
Batch/vid2ani.sh
@@ -2,12 +2,11 @@
|
||||
# Description: Video to GIF/APNG/WEBP converter
|
||||
# By: MDHEXT, Nabi KaramAliZadeh, Pathduck
|
||||
# Version: 6.0
|
||||
# Url: https://github.com/Pathduck/vid2ani/ forked from https://github.com/MDHEXT/video2gif
|
||||
# What this script is based on: http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
|
||||
# Url: https://github.com/Pathduck/vid2ani/
|
||||
# License: GNU General Public License v3.0 (GPLv3)
|
||||
|
||||
# Enable error handling
|
||||
set -euo pipefail
|
||||
# set -euo pipefail
|
||||
|
||||
### Start Main ###
|
||||
main() {
|
||||
@@ -20,60 +19,24 @@ YELLOW=$(tput setaf 11)
|
||||
BLUE=$(tput setaf 12)
|
||||
CYAN=$(tput setaf 14)
|
||||
|
||||
# Default values
|
||||
fps=15
|
||||
mode=1
|
||||
dither=0
|
||||
colormax=256
|
||||
scale="-1"
|
||||
filetype="gif"
|
||||
loglevel="error"
|
||||
bayerscale=""
|
||||
start_time=""
|
||||
end_time=""
|
||||
trim=""
|
||||
webp_lossy=""
|
||||
errorswitch=""
|
||||
errordiff=""
|
||||
picswitch=""
|
||||
|
||||
# Check input
|
||||
# Checking for blank input or help commands
|
||||
if [ $# -eq 0 ]; then print_help; exit; fi
|
||||
case "$1" in
|
||||
-h) print_help; exit;;
|
||||
-?) print_help; exit;;
|
||||
--help) print_help; exit;;
|
||||
esac
|
||||
|
||||
# Assign input and output
|
||||
input="$1"
|
||||
output="${input%.*}"
|
||||
|
||||
echo "Input file: $input"
|
||||
echo "Output file: $output"
|
||||
|
||||
# Parse Arguments
|
||||
shift
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-r) scale="$2"; shift 2;;
|
||||
-f) fps="$2"; shift 2;;
|
||||
-m) mode="$2"; shift 2;;
|
||||
-d) dither="$2"; shift 2;;
|
||||
-b) bayerscale="$2"; shift 2;;
|
||||
-t) filetype="$2"; shift 2;;
|
||||
-o) output="${2%.*}"; shift 2;;
|
||||
-s) start_time="$2"; shift 2;;
|
||||
-e) end_time="$2"; shift 2;;
|
||||
-c) colormax="$2"; shift 2;;
|
||||
-l) webp_lossy="$2"; shift 2;;
|
||||
-v) loglevel="$2"; shift 2;;
|
||||
-k) errorswitch=1; shift;;
|
||||
-p) picswitch=1; shift;;
|
||||
-h|--help) print_help; exit;;
|
||||
*) echo ${RED}"Unknown option $1"${OFF}; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Input validation
|
||||
if [[ -z "$input" ]]; then
|
||||
echo "Input file is required."; print_help; exit 1
|
||||
# Validate input file
|
||||
if [[ ! -f "$input" ]]; then
|
||||
echo ${RED}"Input file not found: $input"${OFF}; exit 1
|
||||
fi
|
||||
|
||||
# Fix paths for Cygwin and create working dir
|
||||
# Fix paths for Cygwin and create working directory
|
||||
if [[ "$(uname -o)" == "Cygwin" ]]; then
|
||||
# Use Windows-compatible directories for Cygwin
|
||||
input=$(cygpath -w "$input")
|
||||
@@ -87,6 +50,46 @@ fi
|
||||
# Cleanup on exit, interrupt, termination
|
||||
trap 'rm -rf "$WD"' EXIT INT TERM
|
||||
|
||||
# Clearing input vars and setting defaults
|
||||
fps=15
|
||||
mode=1
|
||||
dither=0
|
||||
scale="-1"
|
||||
filetype="gif"
|
||||
webp_lossy=""
|
||||
webp_lossy_def=75
|
||||
loglevel="error"
|
||||
bayerscale=""
|
||||
colormax=""
|
||||
start_time=""
|
||||
end_time=""
|
||||
errorswitch=""
|
||||
picswitch=""
|
||||
|
||||
# Parse Arguments
|
||||
shift
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-o) output="${2%.*}"; shift;;
|
||||
-t) filetype="$2"; shift;;
|
||||
-r) scale="$2"; shift;;
|
||||
-l) if [[ "$2" =~ ^[0-9]+$ ]]; then webp_lossy="$2"; shift
|
||||
else webp_lossy=$webp_lossy_def; fi ;;
|
||||
-f) fps="$2"; shift;;
|
||||
-s) start_time="$2"; shift;;
|
||||
-e) end_time="$2"; shift;;
|
||||
-d) dither="$2"; shift;;
|
||||
-b) bayerscale="$2"; shift;;
|
||||
-m) mode="$2"; shift;;
|
||||
-c) colormax="$2"; shift;;
|
||||
-v) loglevel="$2"; shift;;
|
||||
-k) errorswitch=1;;
|
||||
-p) picswitch=1;;
|
||||
*) echo ${RED}"Unknown option $1"${OFF}; exit 1;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Validate output file extension
|
||||
case "$filetype" in
|
||||
gif) output="$output.gif";;
|
||||
@@ -96,9 +99,6 @@ case "$filetype" in
|
||||
*) echo ${RED}"Invalid file type: $filetype"${OFF}; exit 1;;
|
||||
esac
|
||||
|
||||
echo "Input file: $input"
|
||||
echo "Output file: $output"
|
||||
|
||||
# Validate Palettegen
|
||||
if [[ "$mode" -lt 1 || "$mode" -gt 3 ]]; then
|
||||
echo ${RED}"Not a valid palettegen (-m) mode"${OFF}; exit 1
|
||||
@@ -129,23 +129,6 @@ if [[ -n "$webp_lossy" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "$start_time" ]]; then
|
||||
echo start er satt
|
||||
fi
|
||||
|
||||
if [[ -z "$start_time" ]]; then
|
||||
echo start er null
|
||||
fi
|
||||
|
||||
if [[ -n "$end_time" ]]; then
|
||||
echo end er satt
|
||||
fi
|
||||
|
||||
if [[ -z "$end_time" ]]; then
|
||||
echo end er null
|
||||
fi
|
||||
|
||||
|
||||
# Validate Clipping
|
||||
if [[ -n "$start_time" && -z "$end_time" ]]; then
|
||||
echo ${RED}"End time (-e) is required when Start time (-e) is specified."${OFF}; exit 1
|
||||
@@ -161,7 +144,7 @@ if [[ "$fps" -le 0 ]]; then
|
||||
fi
|
||||
|
||||
# Validate Max Colors
|
||||
if [[ "$colormax" -lt 3 || "$colormax" -gt 256 ]]; then
|
||||
if [[ -n "$colormax" && "$colormax" -lt 3 || "$colormax" -gt 256 ]]; then
|
||||
echo ${RED}"Max colors (-c) must be between 3 and 256."${OFF}; exit 1
|
||||
fi
|
||||
|
||||
@@ -171,8 +154,8 @@ echo ${YELLOW}"$ffmpeg_version"${OFF}
|
||||
echo ${GREEN}Output file:${OFF} $output
|
||||
|
||||
## Putting together command to generate palette ##
|
||||
filters="fps=$fps,scale=$scale:-1:flags=lanczos"
|
||||
palette="$WD/palette_%05d.png"
|
||||
filters="fps=$fps,scale=$scale:-1:flags=lanczos"
|
||||
|
||||
# APNG muxer does not support multiple palettes so fallback to using palettegen diff mode
|
||||
if [[ "$filetype" == "apng" && "$mode" -eq 2 ]]; then
|
||||
@@ -181,7 +164,6 @@ if [[ "$filetype" == "apng" && "$mode" -eq 2 ]]; then
|
||||
fi
|
||||
|
||||
# Palettegen encode mode
|
||||
encode=""
|
||||
if [[ -n "$mode" ]]; then
|
||||
case "$mode" in
|
||||
1) encode="palettegen=stats_mode=diff";;
|
||||
@@ -192,7 +174,6 @@ if [[ -n "$mode" ]]; then
|
||||
fi
|
||||
|
||||
# Max colors
|
||||
mcol=""
|
||||
if [[ -n "$colormax" ]]; then
|
||||
if [[ "$mode" -le 2 ]]; then mcol=":max_colors=${colormax}"; fi
|
||||
if [[ "$mode" -eq 3 ]]; then mcol="=max_colors=${colormax}"; fi
|
||||
@@ -231,7 +212,6 @@ if [[ -n "$errorswitch" ]]; then
|
||||
fi
|
||||
|
||||
# Prepare dithering and encoding options
|
||||
ditheralg="none"
|
||||
case "$dither" in
|
||||
0) ditheralg="none";;
|
||||
1) ditheralg="bayer";;
|
||||
@@ -242,11 +222,10 @@ case "$dither" in
|
||||
6) ditheralg="sierra3";;
|
||||
7) ditheralg="burkes";;
|
||||
8) ditheralg="atkinson";;
|
||||
*) echo ${RED}"Invalid dither (-d )mode"${OFF}; exit 1;;
|
||||
*) echo ${RED}"Invalid dither (-d ) mode"${OFF}; exit 1;;
|
||||
esac
|
||||
|
||||
# Paletteuse error diffusion
|
||||
ditherenc=""
|
||||
if [[ "$mode" -ne 2 ]]; then
|
||||
if [[ -n "$errorswitch" ]]; then ditherenc=":dither=$ditheralg"; fi
|
||||
if [[ -z "$errorswitch" ]]; then ditherenc="=dither=$ditheralg"; fi
|
||||
@@ -260,7 +239,9 @@ if [[ -z "$bayerscale" ]]; then bayer=""; fi
|
||||
|
||||
# WEBP pixel format and lossy quality
|
||||
if [[ "$filetype" == "webp" && -n "$webp_lossy" ]]; then
|
||||
webp_lossy="-lossless 0 -pix_fmt yuva420p -quality $webp_lossy"
|
||||
webp_lossy="-lossless 0 -quality $webp_lossy -pix_fmt yuva420p"
|
||||
elif [[ "$filetype" == "webp" && -z "$webp_lossy" ]]; then
|
||||
webp_lossy="-lossless 1"
|
||||
fi
|
||||
|
||||
# Executing the encoding command
|
||||
@@ -270,10 +251,10 @@ ffmpeg -v "${loglevel}" ${trim:-} -i "${input}" -thread_queue_size 512 -i "${pal
|
||||
|
||||
# Checking if output file was created
|
||||
if [[ ! -f "$output" ]]; then
|
||||
echo ${RED}"Failed to generate animation."${OFF}; exit 1
|
||||
echo ${RED}"Failed to generate animation: $output not found"${OFF}; exit 1
|
||||
fi
|
||||
|
||||
# Open output if picswitch is enabled
|
||||
# Open output file if picswitch is enabled
|
||||
if [[ -n "$picswitch" ]]; then
|
||||
xdg-open "$output"
|
||||
fi
|
||||
@@ -293,22 +274,22 @@ ${GREEN}Usage:${OFF}
|
||||
$(basename $0) [input_file] [arguments]
|
||||
|
||||
${GREEN}Arguments:${OFF}
|
||||
-o Output file. Default is the same as input file, sans extension.
|
||||
-t Output file type. Valid: 'gif' (default), 'apng', 'png', 'webp'.
|
||||
-o Output file. The default is the same name as the input video.
|
||||
-r Scale or size. Width of the animation in pixels.
|
||||
-l Enable lossy WebP compression and quality. Range 0-100, default 75.
|
||||
-f Framerate in frames per seconds, default 15.
|
||||
-s Start time of the animation (HH:MM:SS.MS).
|
||||
-e End time of the animation (HH:MM:SS.MS).
|
||||
-f Framerate in frames per second (default: 15).
|
||||
-d Dithering algorithm to be used (default: 0).
|
||||
-b Bayer Scale setting. Range 0 - 5 (default: 2).
|
||||
-m Palettegen mode: 1 (diff), 2 (single), 3 (full) (default: 1).
|
||||
-c Maximum colors usable per palette. Range 3 - 256 (default).
|
||||
-d Dithering algorithm to be used, default 0.
|
||||
-b Bayer Scale setting. Range 0-5, default 2.
|
||||
-m Palettegen mode: 1 (diff), 2 (single), 3 (full), default 1.
|
||||
-c Maximum colors usable per palette. Range 3-256 (default).
|
||||
-k Enables paletteuse error diffusion.
|
||||
-l Enable lossy WebP compression and quality. Range 0 - 100.
|
||||
-p Opens the resulting animation in the default image viewer.
|
||||
-v Set FFmpeg log level (default: error).
|
||||
-p Opens the resulting animation in the default viewer.
|
||||
|
||||
${GREEN}Dithering Mode${OFF}
|
||||
${GREEN}Dithering Algorithms${OFF}
|
||||
0: None
|
||||
1: Bayer
|
||||
2: Heckbert
|
||||
|
||||
@@ -1,54 +1,65 @@
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
call :setESC
|
||||
|
||||
cls
|
||||
echo [101;93m STYLES [0m
|
||||
echo ^<ESC^>[0m [0mReset[0m
|
||||
echo ^<ESC^>[1m [1mBold[0m
|
||||
echo ^<ESC^>[4m [4mUnderline[0m
|
||||
echo ^<ESC^>[7m [7mInverse[0m
|
||||
echo %ESC%[101;93m STYLES %ESC%[0m
|
||||
echo ^<ESC^>[0m %ESC%[0mReset%ESC%[0m
|
||||
echo ^<ESC^>[1m %ESC%[1mBold%ESC%[0m
|
||||
echo ^<ESC^>[4m %ESC%[4mUnderline%ESC%[0m
|
||||
echo ^<ESC^>[7m %ESC%[7mInverse%ESC%[0m
|
||||
echo.
|
||||
echo [101;93m NORMAL FOREGROUND COLORS [0m
|
||||
echo ^<ESC^>[30m [30mBlack[0m (black)
|
||||
echo ^<ESC^>[31m [31mRed[0m
|
||||
echo ^<ESC^>[32m [32mGreen[0m
|
||||
echo ^<ESC^>[33m [33mYellow[0m
|
||||
echo ^<ESC^>[34m [34mBlue[0m
|
||||
echo ^<ESC^>[35m [35mMagenta[0m
|
||||
echo ^<ESC^>[36m [36mCyan[0m
|
||||
echo ^<ESC^>[37m [37mWhite[0m
|
||||
echo %ESC%[101;93m NORMAL FOREGROUND COLORS %ESC%[0m
|
||||
echo ^<ESC^>[30m %ESC%[30mBlack%ESC%[0m (black)
|
||||
echo ^<ESC^>[31m %ESC%[31mRed%ESC%[0m
|
||||
echo ^<ESC^>[32m %ESC%[32mGreen%ESC%[0m
|
||||
echo ^<ESC^>[33m %ESC%[33mYellow%ESC%[0m
|
||||
echo ^<ESC^>[34m %ESC%[34mBlue%ESC%[0m
|
||||
echo ^<ESC^>[35m %ESC%[35mMagenta%ESC%[0m
|
||||
echo ^<ESC^>[36m %ESC%[36mCyan%ESC%[0m
|
||||
echo ^<ESC^>[37m %ESC%[37mWhite%ESC%[0m
|
||||
echo.
|
||||
echo [101;93m NORMAL BACKGROUND COLORS [0m
|
||||
echo ^<ESC^>[40m [40mBlack[0m
|
||||
echo ^<ESC^>[41m [41mRed[0m
|
||||
echo ^<ESC^>[42m [42mGreen[0m
|
||||
echo ^<ESC^>[43m [43mYellow[0m
|
||||
echo ^<ESC^>[44m [44mBlue[0m
|
||||
echo ^<ESC^>[45m [45mMagenta[0m
|
||||
echo ^<ESC^>[46m [46mCyan[0m
|
||||
echo ^<ESC^>[47m [47mWhite[0m (white)
|
||||
echo %ESC%[101;93m NORMAL BACKGROUND COLORS %ESC%[0m
|
||||
echo ^<ESC^>[40m %ESC%[40mBlack%ESC%[0m
|
||||
echo ^<ESC^>[41m %ESC%[41mRed%ESC%[0m
|
||||
echo ^<ESC^>[42m %ESC%[42mGreen%ESC%[0m
|
||||
echo ^<ESC^>[43m %ESC%[43mYellow%ESC%[0m
|
||||
echo ^<ESC^>[44m %ESC%[44mBlue%ESC%[0m
|
||||
echo ^<ESC^>[45m %ESC%[45mMagenta%ESC%[0m
|
||||
echo ^<ESC^>[46m %ESC%[46mCyan%ESC%[0m
|
||||
echo ^<ESC^>[47m %ESC%[47mWhite%ESC%[0m (white)
|
||||
echo.
|
||||
echo [101;93m STRONG FOREGROUND COLORS [0m
|
||||
echo ^<ESC^>[90m [90mWhite[0m
|
||||
echo ^<ESC^>[91m [91mRed[0m
|
||||
echo ^<ESC^>[92m [92mGreen[0m
|
||||
echo ^<ESC^>[93m [93mYellow[0m
|
||||
echo ^<ESC^>[94m [94mBlue[0m
|
||||
echo ^<ESC^>[95m [95mMagenta[0m
|
||||
echo ^<ESC^>[96m [96mCyan[0m
|
||||
echo ^<ESC^>[97m [97mWhite[0m
|
||||
echo %ESC%[101;93m STRONG FOREGROUND COLORS %ESC%[0m
|
||||
echo ^<ESC^>[90m %ESC%[90mWhite%ESC%[0m
|
||||
echo ^<ESC^>[91m %ESC%[91mRed%ESC%[0m
|
||||
echo ^<ESC^>[92m %ESC%[92mGreen%ESC%[0m
|
||||
echo ^<ESC^>[93m %ESC%[93mYellow%ESC%[0m
|
||||
echo ^<ESC^>[94m %ESC%[94mBlue%ESC%[0m
|
||||
echo ^<ESC^>[95m %ESC%[95mMagenta%ESC%[0m
|
||||
echo ^<ESC^>[96m %ESC%[96mCyan%ESC%[0m
|
||||
echo ^<ESC^>[97m %ESC%[97mWhite%ESC%[0m
|
||||
echo.
|
||||
echo [101;93m STRONG BACKGROUND COLORS [0m
|
||||
echo ^<ESC^>[100m [100mBlack[0m
|
||||
echo ^<ESC^>[101m [101mRed[0m
|
||||
echo ^<ESC^>[102m [102mGreen[0m
|
||||
echo ^<ESC^>[103m [103mYellow[0m
|
||||
echo ^<ESC^>[104m [104mBlue[0m
|
||||
echo ^<ESC^>[105m [105mMagenta[0m
|
||||
echo ^<ESC^>[106m [106mCyan[0m
|
||||
echo ^<ESC^>[107m [107mWhite[0m
|
||||
echo %ESC%[101;93m STRONG BACKGROUND COLORS %ESC%[0m
|
||||
echo ^<ESC^>[100m %ESC%[100mBlack%ESC%[0m
|
||||
echo ^<ESC^>[101m %ESC%[101mRed%ESC%[0m
|
||||
echo ^<ESC^>[102m %ESC%[102mGreen%ESC%[0m
|
||||
echo ^<ESC^>[103m %ESC%[103mYellow%ESC%[0m
|
||||
echo ^<ESC^>[104m %ESC%[104mBlue%ESC%[0m
|
||||
echo ^<ESC^>[105m %ESC%[105mMagenta%ESC%[0m
|
||||
echo ^<ESC^>[106m %ESC%[106mCyan%ESC%[0m
|
||||
echo ^<ESC^>[107m %ESC%[107mWhite%ESC%[0m
|
||||
echo.
|
||||
echo [101;93m COMBINATIONS [0m
|
||||
echo ^<ESC^>[31m [31mred foreground color[0m
|
||||
echo ^<ESC^>[7m [7minverse foreground ^<-^> background[0m
|
||||
echo ^<ESC^>[7;31m [7;31minverse red foreground color[0m
|
||||
echo ^<ESC^>[7m and nested ^<ESC^>[31m [7mbefore [31mnested[0m
|
||||
echo ^<ESC^>[31m and nested ^<ESC^>[7m [31mbefore [7mnested[0m
|
||||
echo %ESC%[101;93m COMBINATIONS %ESC%[0m
|
||||
echo ^<ESC^>[31m %ESC%[31mred foreground color%ESC%[0m
|
||||
echo ^<ESC^>[7m %ESC%[7minverse foreground ^<-^> background%ESC%[0m
|
||||
echo ^<ESC^>[7;31m %ESC%[7;31minverse red foreground color%ESC%[0m
|
||||
echo ^<ESC^>[7m and nested ^<ESC^>[31m %ESC%[7mbefore %ESC%[31mnested%ESC%[0m
|
||||
echo ^<ESC^>[31m and nested ^<ESC^>[7m %ESC%[31mbefore %ESC%[7mnested%ESC%[0m
|
||||
|
||||
:setESC
|
||||
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
|
||||
set ESC=%%b
|
||||
exit /B 0
|
||||
)
|
||||
exit /B 0
|
||||
|
||||
@@ -15,7 +15,6 @@ egrep=grep -E $*
|
||||
far=d:\bin\FarManager\Far.exe $*
|
||||
ga=git add -A $*
|
||||
gc=git commit $*
|
||||
gl=git log --oneline --all --graph --decorate $*
|
||||
gs=git status $*
|
||||
home=cd /d "%USERPROFILE%"
|
||||
la=ls -la --color=auto --group-directories-first $*
|
||||
@@ -33,7 +32,6 @@ putty=d:\bin\putty\putty.exe $*
|
||||
pwd=cd
|
||||
python=d:\bin\python\python.exe $*
|
||||
rm=rm -i $*
|
||||
shn=sh "d:\bin\cygwin\usr\local\bin\pb" -u $*
|
||||
sublime=d:\bin\Sublime\sublime_text.exe $*
|
||||
sudo=elevate -k $*
|
||||
tc=d:\bin\totalcmd\totalcmd.exe $*
|
||||
@@ -42,3 +40,6 @@ tshark=d:\bin\Wireshark\tshark.exe $*
|
||||
unalias=alias /d $1
|
||||
vi=vim $*
|
||||
winscp=d:\bin\WinSCP\winscp.exe $*
|
||||
gh=git hist $*
|
||||
gl=git log --oneline --all --graph --decorate --color $*
|
||||
shn=curl -F "shorten=$*" "https://envs.sh"
|
||||
|
||||
@@ -330,7 +330,7 @@
|
||||
<WordsStyle name="COMPLEX VARIABLE" styleID="104" fgColor="808080" bgColor="001B33" fontName="" fontStyle="1" fontSize=""></WordsStyle>
|
||||
<WordsStyle name="STRING VARIABLE" styleID="126" fgColor="C8C8C8" bgColor="001B33" fontName="" fontStyle="0" fontSize=""></WordsStyle>
|
||||
<WordsStyle name="SIMPLE STRING" styleID="120" fgColor="3AD900" bgColor="001B33" fontName="" fontStyle="0" fontSize=""></WordsStyle>
|
||||
<WordsStyle name="WORD" styleID="121" fgColor="FF9D00" bgColor="001B33" fontName="" fontStyle="1" fontSize="" keywordClass="instre1"></WordsStyle>
|
||||
<WordsStyle name="KEYWORDS" styleID="121" fgColor="FF9D00" bgColor="001B33" fontName="" fontStyle="1" fontSize="" keywordClass="instre1"></WordsStyle>
|
||||
<WordsStyle name="NUMBER" styleID="122" fgColor="FF0044" bgColor="001B33" fontName="" fontStyle="0" fontSize=""></WordsStyle>
|
||||
<WordsStyle name="VARIABLE" styleID="123" fgColor="C8C8C8" bgColor="001B33" fontName="" fontStyle="0" fontSize=""></WordsStyle>
|
||||
<WordsStyle name="COMMENT" styleID="124" fgColor="0088FF" bgColor="001B33" fontName="" fontStyle="2" fontSize=""></WordsStyle>
|
||||
@@ -497,7 +497,7 @@
|
||||
<WidgetStyle name="Change History revert origin" styleID="0" fgColor="40A0BF" bgColor="40A0BF"></WidgetStyle>
|
||||
<WidgetStyle name="Change History saved" styleID="0" fgColor="00A000" bgColor="00A000"></WidgetStyle>
|
||||
<WidgetStyle name="Fold" styleID="0" fgColor="0088FF" bgColor="000D1A" fontSize="" fontStyle="0"></WidgetStyle>
|
||||
<WidgetStyle name="Fold active" styleID="0" fgColor="FF0000" bgColor="343F41" fontSize="" fontStyle="0"></WidgetStyle>
|
||||
<WidgetStyle name="Fold active" styleID="0" fgColor="00F03D" bgColor="343F41" fontSize="" fontStyle="0"></WidgetStyle>
|
||||
<WidgetStyle name="Fold margin" styleID="0" fgColor="001B33" bgColor="003B70" fontSize="" fontStyle="0"></WidgetStyle>
|
||||
<WidgetStyle name="White space symbol" styleID="0" fgColor="FFB56A" bgColor="56676D" fontStyle="0" fontSize=""></WidgetStyle>
|
||||
<WidgetStyle name="Smart Highlighting" styleID="29" bgColor="00FF00" fgColor="E0E2E4" fontSize="" fontStyle="1" colorStyle="1"></WidgetStyle>
|
||||
|
||||
33
XPadder/GrimFandango.xpadderprofile
Executable file
33
XPadder/GrimFandango.xpadderprofile
Executable file
@@ -0,0 +1,33 @@
|
||||
;--- Xpadder Profile File ---
|
||||
DataType=Profile
|
||||
Version=2011.02.09
|
||||
|
||||
[Profile Settings]
|
||||
|
||||
[Set Settings]
|
||||
Set1Stick2Mode=EightWay
|
||||
|
||||
[Assignments]
|
||||
Set1Button1Slots=E
|
||||
Set1Button2Slots=U
|
||||
Set1Button3Slots=P
|
||||
Set1Button6Slots=Dot
|
||||
Set1Button7Slots=I
|
||||
Set1Button8Slots=Alt,F1
|
||||
Set1DPadUpSlots=Escape
|
||||
Set1DPadRightSlots=NumPad +
|
||||
Set1DPadDownSlots=1
|
||||
Set1DPadLeftSlots=NumPad -
|
||||
Set1Stick1UpSlots=Arrow Up
|
||||
Set1Stick1RightSlots=Arrow Right
|
||||
Set1Stick1DownSlots=Arrow Down
|
||||
Set1Stick1LeftSlots=Arrow Left
|
||||
Set1Stick2UpSlots=NumPad 8
|
||||
Set1Stick2RightSlots=NumPad 6
|
||||
Set1Stick2DownSlots=NumPad 2
|
||||
Set1Stick2LeftSlots=NumPad 4
|
||||
Set1Stick2UpRightSlots=NumPad 9
|
||||
Set1Stick2DownRightSlots=NumPad 3
|
||||
Set1Stick2DownLeftSlots=NumPad 1
|
||||
Set1Stick2UpLeftSlots=NumPad 7
|
||||
Set1TriggerLeftSlots=Left Shift
|
||||
29
XPadder/Octodad.xpadderprofile
Executable file
29
XPadder/Octodad.xpadderprofile
Executable file
@@ -0,0 +1,29 @@
|
||||
;--- Xpadder Profile File ---
|
||||
DataType=Profile
|
||||
Version=2012.05.01
|
||||
|
||||
[Profile Settings]
|
||||
|
||||
[Set Settings]
|
||||
|
||||
[Assignments]
|
||||
Set1Button1Slots=Left Mouse Button (1)
|
||||
Set1Button2Slots=Space
|
||||
Set1Button5Slots=Left Mouse Button (1)
|
||||
Set1Button6Slots=Right Mouse Button (2)
|
||||
Set1Button7Slots=Escape
|
||||
Set1Button10Slots=Space
|
||||
Set1Stick1UpSlots=Mouse Move Up
|
||||
Set1Stick1UpMouseSpeed=32
|
||||
Set1Stick1RightSlots=Mouse Move Right
|
||||
Set1Stick1RightMouseSpeed=32
|
||||
Set1Stick1DownSlots=Mouse Move Down
|
||||
Set1Stick1DownMouseSpeed=32
|
||||
Set1Stick1LeftSlots=Mouse Move Left
|
||||
Set1Stick1LeftMouseSpeed=32
|
||||
Set1Stick2UpSlots=W
|
||||
Set1Stick2RightSlots=D
|
||||
Set1Stick2DownSlots=S
|
||||
Set1Stick2LeftSlots=A
|
||||
Set1TriggerLeftSlots=Left Mouse Button (1)
|
||||
Set1TriggerRightSlots=Right Mouse Button (2)
|
||||
17
XPadder/Thomas Was Alone.xpadderprofile
Executable file
17
XPadder/Thomas Was Alone.xpadderprofile
Executable file
@@ -0,0 +1,17 @@
|
||||
;--- Xpadder Profile File ---
|
||||
DataType=Profile
|
||||
Version=2012.05.01
|
||||
|
||||
[Profile Settings]
|
||||
|
||||
[Set Settings]
|
||||
|
||||
[Assignments]
|
||||
Set1Button1Slots=Space
|
||||
Set1Button5Slots=Q
|
||||
Set1Button6Slots=E
|
||||
Set1Button7Slots=Escape
|
||||
Set1DPadUpSlots=Arrow Up
|
||||
Set1DPadDownSlots=Arrow Down
|
||||
Set1Stick1RightSlots=Arrow Right
|
||||
Set1Stick1LeftSlots=Arrow Left
|
||||
Reference in New Issue
Block a user