Add files via upload

This commit is contained in:
MDHEXT
2021-11-03 23:30:34 -06:00
committed by GitHub
parent 2e029c8f1b
commit d02f65cfe8
+46 -37
View File
@@ -1,7 +1,7 @@
REM By: MDHEXT, Nabi KaramAliZadeh <nabikaz@gmail.com>
@ECHO OFF
REM By: MDHEXT, Nabi KaramAliZadeh <nabikaz@gmail.com>
REM Description: Video to GIF converter
REM Version: 4.4
REM Version: 4.6
REM Url: https://github.com/MDHEXT/video2gif, forked from https://github.com/NabiKAZ/video2gif
REM License: The MIT License (MIT)
@@ -26,36 +26,36 @@ GOTO :help_check_1
:help_message
ECHO -------------------------------------------------------------------------------------------------------------
ECHO Video to GIF converter v4.4 ^(C^) 2017-2021, MDHEXT ^&^ Nabi KaramAliZadeh ^<nabikaz@gmail.com^>
ECHO You can download this fork from here: https://github.com/MDHEXT/video2gif
ECHO you can download the original release here: https://github.com/NabiKAZ/video2gif
ECHO This tool uses ffmpeg, you can download that here: https://www.ffmpeg.org/download.html#build-windows
ECHO Video to GIF converter v4.6 ^(C^) 2017-2021, MDHEXT ^&^ Nabi KaramAliZadeh ^<nabikaz@gmail.com^>
ECHO You can download this fork from here: https://github.com/MDHEXT/video2gif
ECHO you can download the original release here: https://github.com/NabiKAZ/video2gif
ECHO This tool uses ffmpeg, you can download that here: https://www.ffmpeg.org/download.html#build-windows
ECHO -------------------------------------------------------------------------------------------------------------
ECHO Usage:
ECHO Usage:
ECHO gifconv [input_file] [Arguments]
ECHO -------------------------------------------------------------------------------------------------------------
ECHO Arguments:
ECHO -o : Specifies output filename. (will be outputted to the same directory as your input video file.)
ECHO If left empty, this will default to the same filename as your video. (Optional)
ECHO Arguments:
ECHO -o : Specifies output filename. (will be outputted to the same directory as your input video file.)
ECHO If left empty, this will default to the same filename as your video. (Optional)
ECHO -r : Specifies scale or size. The amount of pixels this value is set to will be the width of the gif.
ECHO The default is the same scale as the original video.
ECHO -f : Specifies framerate in Hz. The default is 15.
ECHO -m : Specifies one of the 3 modes listed below. The default is diff.
ECHO -d : Specifies which dithering algorithm to be used. The default is Bayer.
ECHO -b : Specifies the Bayer Scale. This can only be used when Bayer Dithering is applied. See more
ECHO information below. (Optional)
ECHO -s : Specifies the start of the gif file in HH:MM:SS.MS format. (Optional)
ECHO -e : Specifies the duration of the gif file in seconds. (Optional)
ECHO -c : Sets the maximum amount of colors useable per palette. (Value up to 256) This option is disabled
ECHO by default.
ECHO -k : Enables error diffusion. (Optional)
ECHO The default is the same scale as the original video.
ECHO -f : Specifies framerate in Hz. The default is 15.
ECHO -m : Specifies one of the 3 modes listed below. The default is diff.
ECHO -d : Specifies which dithering algorithm to be used. The default is Bayer.
ECHO -b : Specifies the Bayer Scale. This can only be used when Bayer Dithering is applied. See more
ECHO information below. (Optional)
ECHO -s : Specifies the start of the gif file in HH:MM:SS.MS format. (Optional)
ECHO -e : Specifies the duration of the gif file in seconds. (Optional)
ECHO -c : Sets the maximum amount of colors useable per palette. (Value up to 256) This option is disabled
ECHO by default.
ECHO -k : Enables error diffusion. (Optional)
ECHO -------------------------------------------------------------------------------------------------------------
ECHO Palettegen Modes:
ECHO Palettegen Modes:
ECHO 1: diff - only what moves affects the palette
ECHO 2: single - one palette per frame
ECHO 3: full - one palette for the whole gif
ECHO -------------------------------------------------------------------------------------------------------------
ECHO Dithering Options:
ECHO Dithering Options:
ECHO 1: Bayer
ECHO 2: Heckbert
ECHO 3: Floyd Steinberg
@@ -63,22 +63,23 @@ ECHO 4: Sierra2
ECHO 5: Sierra2_4a
ECHO 6: No Dithering
ECHO -------------------------------------------------------------------------------------------------------------
ECHO About Bayerscale:
ECHO When bayer dithering is selected, the Bayer Scale option defines the scale of the pattern (how much the
ECHO crosshatch pattern is visible). A low value means more visible pattern for less banding, and higher value
ECHO means less visible pattern at the cost of more banding.The option must be an integer value in the range
ECHO [0,5]. The Default is 2. Bayer Scale is optional and can only be enabled when using bayer dithering.
ECHO [0,5]. The Default is 2. Bayer Scale is optional and can only be enabled when using bayer dithering.
GOTO :EOF
:safchek
IF DEFINED bayerscale (
IF !bayerscale! GTR 5 (
ECHO Not a valid bayerscale value
ECHO Not a valid bayerscale value
GOTO :EOF
)
)
IF !bayerscale! LEQ 5 (
IF %dither% EQU 1 GOTO :script_start
IF %dither% NEQ 1 (
ECHO This setting only works with bayer dithering
ECHO This setting only works with bayer dithering
GOTO :EOF
)
)
@@ -115,19 +116,23 @@ IF NOT DEFINED dither SET dither=1
GOTO :safchek
:script_start
ECHO Creating Working Directory...
ECHO Creating Working Directory...
MD "%WD%"
:palettegen
ECHO Generating Palette...
ECHO Generating Palette...
IF DEFINED start_time (
IF DEFINED duration SET "trim=-ss !start_time! -t !duration!"
IF NOT DEFINED duration (
ECHO Please input a duration
ECHO Please input a duration
GOTO :EOF
)
)
IF NOT DEFINED start_time (
IF DEFINED duration ECHO Please input a start time
)
SET frames=%palette%
SET filters=fps=%fps%,scale=%scale%:-1:flags=lanczos
@@ -141,13 +146,15 @@ IF DEFINED colormax (
)
ffmpeg -v warning %trim% -i %vid% -vf "%filters%,%encode%%mcol%" -y "%frames%.png"
IF NOT EXIST "%palette%_00001.png" (
IF NOT EXIST "%palette%.png" (
ECHO Failed to generate palette file
ECHO Failed to generate palette file
GOTO :cleanup
)
)
)
ECHO Encoding Gif file...
ECHO Encoding Gif file...
IF %mode% EQU 1 SET decode=paletteuse
IF %mode% EQU 2 SET "decode=paletteuse=new=1" & SET frames=%palette%_%%05d
IF %mode% EQU 3 SET decode=paletteuse
@@ -176,12 +183,14 @@ IF NOT DEFINED bayerscale SET "bayer="
IF DEFINED bayerscale SET bayer=:bayer_scale=%bayerscale%
ffmpeg -v warning %trim% -i %vid% -thread_queue_size 512 -i "%frames%.png" -lavfi "%filters% [x]; [x][1:v] %decode%%errordiff%%ditherenc%%bayer%" -y %output%
IF NOT EXIST %output% (
ECHO Failed to generate gif file
ECHO Failed to generate gif file
GOTO :cleanup
)
:cleanup
ECHO Deleting Temporary files...
ECHO Deleting Temporary files...
RMDIR /S /Q "%WD%"
ENDLOCAL
ECHO Done!
ECHO Done!