-
Notifications
You must be signed in to change notification settings - Fork 28
/
Video-ToGIF_64ColorsStyle.bat
61 lines (47 loc) · 2.12 KB
/
Video-ToGIF_64ColorsStyle.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
REM https://medium.com/@colten_jackson/doing-the-gif-thing-on-debian-82b9760a8483
REM http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
REM https://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
REM https://gist.github.com/keijiro/b46d94f4cd1b159c59a72cd616f95017
REM https://superuser.com/questions/1231645/ffmpeg-generate-and-use-different-palette-for-every-frame
@echo off
echo %CD%
echo %~dp0
cd /d %~dp0
ECHO. & ECHO ******* BAT FILE *******
ECHO %~nx0
ECHO ************************ & ECHO.
REM Creating the Results Directory - GIFs
set RESULTS_DIR="GIFs"
call SYS_MakeResultsDir.bat %RESULTS_DIR%
REM For first file
REM %1
REM For multiple files
echo %*
set COUNTER=0
for %%x in (%*) do (
echo %%x
set /A COUNTER+=1
)
echo COUNTER = %COUNTER%
if %COUNTER% GTR 0 (
if %COUNTER% EQU 1 (
echo _____GET ONE FILE_____
) else (
echo _____GET MULTI FILES: %COUNTER% files_____
)
for %%x in (%*) do (
REM //////////////////// MAIN \\\\\\\\\\\\\\\\\\\\\\\\\
REM For Full File (create palette.png - "Video-ToGIF_palette.png", then create gif - I am happy)
ffmpeg.exe -i %%x -vf fps=30,scale=-1:-1:flags=lanczos,palettegen=max_colors=64 Video-ToGIF_palette.png -y
ffmpeg.exe -i %%x -i Video-ToGIF_palette.png -filter_complex "fps=10,scale=-1:-1:flags=lanczos[x];[x][1:v]paletteuse=dither=bayer:bayer_scale=5" "%RESULTS_DIR%\%%~nx_Output_64ColorsStyle.gif"
REM TESTs
REM ffmpeg.exe -ss 00:19:07 -t 1.3 -i %%x -vf fps=15,scale=320:-1:flags=lanczos,palettegen Video-ToGIF_palette.png -y
REM ffmpeg.exe -ss 00:19:07 -t 1.3 -i %%x -i Video-ToGIF_palette.png -filter_complex "fps=15,scale=400:-1:flags=lanczos[x];[x][1:v] paletteuse" "%%~nx_output.gif"
REM (create palette.png - "Video-ToGIF_palette.png", then create gif - I am happy)
REM ffmpeg.exe -ss 00:19:07 -t 1.3 -i %%x -vf fps=15,scale=-1:-1:flags=lanczos,palettegen Video-ToGIF_palette.png -y
REM ffmpeg.exe -ss 00:19:07 -t 1.3 -i %%x -i Video-ToGIF_palette.png -filter_complex "fps=15,scale=-1:-1:flags=lanczos[x];[x][1:v]paletteuse" "%%~nx_output_16Bit.gif"
)
) else (
echo _____GET NO ONE FILES_____
)
pause