Skip to content

Commit 2c3c189

Browse files
committed
Release 3
Image sequence input support Structural overhaul Presets overhaul
1 parent ddfeba7 commit 2c3c189

File tree

56 files changed

+2369
-2290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2369
-2290
lines changed

Diff for: sendtoffmpeg_encoder01.cmd

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
REM This is one of the SenTo FFmpeg modular transcoders, keep it with the rest of the files
2+
3+
ECHO [----------------------------------------------------------------------------------------]
4+
ECHO [ %argCount% files queued to encode
5+
6+
FOR /L %%i IN (1,1,%argCount%) DO (
7+
8+
ECHO [----------------------------------------------------------------------------------------]
9+
10+
SET "vlen="
11+
FOR /F "tokens=* delims=" %%f IN ('call "%ffpath%ffprobe.exe" -v error -show_entries "format=duration" -of "default=noprint_wrappers=1:nokey=1" "!argFile[%%i].name!"') DO SET "vlen=%%f"
12+
13+
IF !vlen! == N/A (
14+
ECHO [ The source is a single image file with no length
15+
16+
IF !imgseq! GTR 0 (
17+
REM detecting image sequence
18+
IF !frcounter! GTR 0 (
19+
REM detecting the counter in the end of the filename
20+
SET "basename=!argFile[%%i].trname:~0,-%frcounter%!"
21+
SET "countername=!argFile[%%i].trname:~-%frcounter%!"
22+
FOR /F "tokens=* delims=0" %%N IN ("!countername!") DO SET /A frnumber=%%N
23+
IF !frnumber! GTR 0 (
24+
SET "argFile[%%i].name=!argFile[%%i].path!!basename!%%0!frcounter!d!argFile[%%i].ext!"
25+
ECHO [ Image sequence detected ]
26+
ECHO [ Basename: "!basename!" Start frame: !frnumber! Pattern: "!basename!%%0!frcounter!d"
27+
SET "wset.seqfr=-framerate %fps% -start_number !frnumber! -pattern_type sequence"
28+
SET "wset.seqfrout=-r %fps%"
29+
REM No audio assumed
30+
SET "wset.audiocomp="
31+
) ELSE (
32+
SET "wset.seqfr="
33+
SET "wset.seqfrout="
34+
)
35+
) ELSE (
36+
REM detecting the counter after first found dot
37+
REM No implementation yet
38+
)
39+
) ELSE (
40+
SET "wset.seqfr="
41+
SET "wset.seqfrout="
42+
)
43+
) ELSE (
44+
ECHO [ Video length is: !vlen! seconds
45+
)
46+
47+
ECHO [ Transcoding %%i of %argCount%: !argFile[%%i].trname!
48+
"%ffpath%ffmpeg.exe" !wset.params! !wset.seqfr! -i "!argFile[%%i].name!" !wset.videocomp! !wset.audiocomp! !wset.seqfrout! !wset.over! "!argFile[%%i].trname!"!wset.suff!
49+
)
50+
51+
ECHO [----------------------------------------------------------------------------------------]
52+
ECHO [ SERVED ]
53+
ECHO [----------------------------------------------------------------------------------------]

Diff for: sendtoffmpeg_encoder02.cmd

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
REM This is one of the SenTo FFmpeg modular transcoders, keep it with the rest of the files
2+
3+
ECHO [----------------------------------------------------------------------------------------]
4+
ECHO [ %argCount% files queued to encode
5+
6+
FOR /L %%i IN (1,1,%argCount%) DO (
7+
8+
ECHO [----------------------------------------------------------------------------------------]
9+
10+
SET "vlen="
11+
FOR /F "tokens=* delims=" %%f IN ('call "%ffpath%ffprobe.exe" -v error -show_entries "format=duration" -of "default=noprint_wrappers=1:nokey=1" "!argFile[%%i].name!"') DO SET "vlen=%%f"
12+
13+
IF !vlen! == N/A (
14+
ECHO [ The source is a single image file with no length
15+
16+
IF !imgseq! GTR 0 (
17+
REM detecting image sequence
18+
IF !frcounter! GTR 0 (
19+
REM detecting the counter in the end of the filename
20+
SET "basename=!argFile[%%i].trname:~0,-%frcounter%!"
21+
SET "countername=!argFile[%%i].trname:~-%frcounter%!"
22+
FOR /F "tokens=* delims=0" %%N IN ("!countername!") DO SET /A frnumber=%%N
23+
IF !frnumber! GTR 0 (
24+
REM overwrite default framerate setting with the preset's one
25+
SET /A fps=%wset.fps%
26+
SET "argFile[%%i].name=!argFile[%%i].path!!basename!%%0!frcounter!d!argFile[%%i].ext!"
27+
ECHO [ Image sequence detected ]
28+
ECHO [ Basename: "!basename!" Start frame: !frnumber! Pattern: "!basename!%%0!frcounter!d"
29+
SET "wset.seqfr=-framerate %fps% -start_number !frnumber! -pattern_type sequence"
30+
REM No audio assumed
31+
SET "wset.audiocomp="
32+
) ELSE (
33+
REM No sequence, no pattern
34+
SET "wset.seqfr="
35+
SET "wset.seqfrout="
36+
)
37+
) ELSE (
38+
REM detecting the counter after first found dot
39+
REM No implementation yet
40+
)
41+
) ELSE (
42+
SET "wset.seqfr="
43+
SET "wset.seqfrout="
44+
)
45+
) ELSE (
46+
echo [ Video length is: !vlen! seconds
47+
)
48+
49+
ECHO [ Encoding file %%i of %argCount%
50+
ECHO [ STAGE 1: Generating a palette ]
51+
"%ffpath%ffmpeg.exe" !wset.params! !wset.seqfr! -i "!argFile[%%i].name!" !wset.prepass! !wset.seqfrout! -y "!argFile[%%i].trname!"palette.png
52+
53+
ECHO [----------------------------------------------------------------------------------------]
54+
ECHO [ Encoding file %%i of %argCount%
55+
ECHO [ STAGE 2: Encoding to Gif using the generatied palette ]
56+
"%ffpath%ffmpeg.exe" !wset.params! !wset.seqfr! -i "!argFile[%%i].name!" -i "!argFile[%%i].trname!"palette.png !wset.videocomp! !wset.over! "!argFile[%%i].trname!"!wset.suff!
57+
58+
IF EXIST "!argFile[%%i].trname!palette.png" DEL /s "!argFile[%%i].trname!palette.png" > nul
59+
)
60+
61+
ECHO [----------------------------------------------------------------------------------------]
62+
ECHO [ SERVED ]
63+
ECHO [----------------------------------------------------------------------------------------]

Diff for: sendtoffmpeg_settings.cmd

+39-16
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,46 @@
1-
REM SendTo_FFmpeg is a set of windows batches for effortless and free transcoding
2-
REM Copyright (c) 2018-2022 Keerah, keerah.com. All rights reserved
3-
REM More information at https://keerah.com https://github.com/keerah/SendTo_FFmpeg
1+
REM SendTo_FFmpeg is a set of windows batches for effortless transcoding
2+
REM Download from https://github.com/keerah/SendTo_FFmpeg
43

54
REM This is a SendTo_FFmpeg settings file
6-
REM You need to be careful here, cause it's an executable part of the script for each preset
5+
rem You have to be careful here, cause it's an executable part of the scripts
6+
rem Scripts won't be able to run without this file nearby.
77

8-
REM If you copy of this file to the folder of your source files, then these localized settings
9-
REM will be used for transcoding all files inside this folder instead of the global settings
10-
REM For example, you can disable the pause after processing or reduce verbose level to errors only
11-
REM for a particular folder only.
8+
REM If you copy this file to the folder of your source files
9+
REM then these "localized" settings will be used for transcoding
10+
REM of the files inside this folder instead of the global settings.
11+
REM For example, you can disable the descriptive name suffixes,
12+
REM use another default framerate or even use another FFmpeg version
13+
REM for a particular folder only
1214

13-
rem Path to ffmpeg.exe
14-
set "ffpath=c:\Program Files\ffmpeg\bin\"
15+
SET "ffpath=c:\Program Files\ffmpeg\bin\"
16+
REM Path to ffmpeg.exe
17+
REM will also look for exiftool.exe here when needed
1518

16-
rem FFmpeg verbosity level, use "info" for full verbosity or "error" for errors only
17-
set "vbl=warning"
19+
SET "vbl=warning"
20+
REM FFmpeg verbosity level
21+
REM "info" for full verbosity, "warning" for all important messaes, "error" for errors only
1822

19-
rem Enable pause after encoding, any positive value enables the pause
20-
set /A pse=1
23+
SET /A pse=1
24+
REM Enable pause after encoding
25+
REM Any positive value enables the pause
2126

22-
rem Descriptive naming for output files, any positive value enables description
23-
set /A dscr=1
27+
SET /A dscr=1
28+
REM Descriptive naming for output files
29+
REM Any positive value enables filename suffixes
30+
31+
SET /A quietover=1
32+
REM Quiet overwrite
33+
REM If it is set to 1, the output files will be always overwritten
34+
35+
SET /A fps=30
36+
REM Default framerate for image seuences
37+
38+
SET /A imgseq=1
39+
REM Consider image sequences
40+
REM if 0 then ffmpeg won't look for image sequences containing the selected file
41+
42+
SET /A frcounter=4
43+
REM Frame counter digits
44+
REM The number of digits in the frame counter to detect (leading zeroes assumed)
45+
REM If set to 0, the scripts will search for the counter after the first dot in the filename
46+
REM taking all digits available (future feature)

Diff for: to APNG forever loop.bat

+84-39
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,108 @@
11
@ECHO OFF
2-
REM SendTo_FFmpeg is a set of windows batches for effortless and free transcoding
3-
REM Copyright (c) 2018-2021 Keerah, keerah.com. All rights reserved
4-
REM More information at https://keerah.com https://github.com/keerah/SendTo_FFmpeg
2+
REM SendTo_FFmpeg is a set of windows batches for effortless transcoding
3+
REM Download from https://github.com/keerah/SendTo_FFmpeg
54

65
setlocal enabledelayedexpansion
76

8-
set argCount=0
9-
for %%x in (%*) do (
10-
set /A argCount+=1
11-
set "argVec[!argCount!]=%%~x"
12-
set "argVn[!argCount!]=%%~nx"
7+
SET argCount=0
8+
FOR %%f IN (%*) DO (
9+
SET /A argCount+=1
10+
SET "argFile[!argCount!].name=%%~f"
11+
SET "argFile[!argCount!].trname=%%~nf"
12+
SET "argFile[!argCount!].ext=%%~xf"
13+
SET "argFile[!argCount!].path=%%~dpf"
1314
)
1415

15-
ECHO [---------------------------------------------------------------------------------]
16-
ECHO [--- SendTo FFmpeg encoder v2.2 by Keerah.com ---]
17-
ECHO [--- Multi APNG module has been invoked ---]
18-
ECHO [--- Preset: plain, loop forever ---]
16+
IF %argCount% LEQ 0 (
17+
ECHO [-----------------------------------------------------------------------------------]
18+
ECHO [ NO FILE^(S^) SPECIFIED ]
19+
GOTO :End
20+
)
21+
22+
ECHO [-----------------------------------------------------------------------------------]
23+
ECHO [--- SendTo FFmpeg encoder v3.0 by Keerah ---]
24+
ECHO [--- Preset: APNG plain, loop forever ---]
1925

20-
set "cmdp=%~dp0"
21-
set "argp=%~dp1"
26+
SET "cmdp=%~dp0"
27+
SET "argp=%~dp1"
2228

29+
REM get settings
2330
IF EXIST "%argp%sendtoffmpeg_settings.cmd" (
2431
CALL "%argp%sendtoffmpeg_settings.cmd"
25-
ECHO [--- Settings: LOCAL ---]
32+
ECHO [--- Settings: *LOCAL*, Verbosity: !vbl!
2633
) ELSE (
27-
CALL "%cmdp%sendtoffmpeg_settings.cmd"
28-
ECHO [--- Settings: GLOBAL ---]
34+
IF EXIST "%cmdp%sendtoffmpeg_settings.cmd" (
35+
CALL "%cmdp%sendtoffmpeg_settings.cmd"
36+
ECHO [--- Settings: Global, Verbosity: !vbl!
37+
) ELSE (
38+
ECHO [--- Sorry, the sendtoffmpeg_settings.cmd is unreacheable. Unable to continue! ---]
39+
GOTO :End
40+
)
2941
)
3042

31-
IF %argCount% == 0 (
32-
33-
ECHO [---------------------------------------------------------------------------------]
34-
ECHO [ NO FILE SPECIFIED ]
35-
GOTO End
43+
REM Check for ffmpeg
44+
IF NOT EXIST "%ffpath%ffmpeg.exe" (
45+
ECHO [--- Sorry, the path to ffmpeg.exe is unreacheable. Unable to continue! ---]
46+
GOTO :End
3647
)
37-
38-
IF %argCount% GTR 1 (
3948

40-
ECHO [---------------------------------------------------------------------------------]
41-
ECHO [ %argCount% files queued to encode
42-
)
4349

44-
IF %dscr% GTR 0 (SET "dscrName=_animpng") ELSE (SET "dscrName=")
50+
REM compression settings
51+
SET "wset.params=-v %vbl% -hide_banner -stats"
52+
SET "wset.videocomp=-f apng -plays 0"
53+
SET "wset.audiocomp="
54+
IF %quietover% == 1 (SET "wset.over=-y") ELSE (SET "wset.over=")
55+
IF %dscr% GTR 0 (SET "wset.dscr=_animpng") ELSE (SET "wset.dscr=")
56+
SET "wset.suff=!wset.dscr!.png"
57+
58+
ECHO [-----------------------------------------------------------------------------------]
59+
ECHO [ %argCount% files queued to encode
4560

4661
FOR /L %%i IN (1,1,%argCount%) DO (
4762

48-
ECHO [---------------------------------------------------------------------------------]
49-
ECHO [ Transcoding %%i of %argCount%: !argVn[%%i]!
63+
ECHO [-----------------------------------------------------------------------------------]
5064

51-
for /F "delims=" %%f in ('call "%ffpath%ffprobe.exe" -v error -show_entries "format=duration" -of "default=noprint_wrappers=1:nokey=1" "!argVec[%%i]!"') do echo [ Video length is: %%f
65+
FOR /F "tokens=* delims=" %%f IN ('call "%ffpath%ffprobe.exe" -v error -show_entries "format=duration" -of "default=noprint_wrappers=1:nokey=1" "!argFile[%%i].name!"') DO SET "vlen=%%f"
5266

53-
"%ffpath%ffmpeg.exe" -v %vbl% -hide_banner -stats -i "!argVec[%%i]!" -f apng -plays 0 -y "!argVn[%%i]!%dscrName%.png"
54-
)
67+
IF !vlen! NEQ "N/A" (
68+
ECHO [ The source is a single image file with no length
69+
70+
IF !imgseq! GTR 0 (
71+
REM detecting image sequence
72+
IF !frcounter! GTR 0 (
73+
REM detecting the counter in the end of the filename
74+
SET "basename=!argFile[%%i].trname:~0,-%frcounter%!"
75+
SET "countername=!argFile[%%i].trname:~-%frcounter%!"
76+
FOR /F "tokens=* delims=0" %%N IN ("!countername!") DO SET /A frnumber=%%N
77+
IF !frnumber! GTR 0 (
78+
SET "argFile[%%i].name=!argFile[%%i].path!!basename!%%0!frcounter!d!argFile[%%i].ext!"
79+
ECHO [ Image sequence detected ]
80+
ECHO [ Basename: "!basename!" Start frame: !frnumber! Pattern: "!basename!%%0!frcounter!d"
81+
SET "seqfr=-framerate %fps% -start_number !frnumber! -pattern_type sequence"
82+
SET "seqfrout=-r %fps%"
83+
) ELSE (
84+
SET "seqfr="
85+
SET "seqfrout="
86+
)
87+
) ELSE (
88+
REM detecting the counter after first found dot
89+
REM No implementation yet
90+
)
91+
) ELSE (
92+
SET "seqfr="
93+
SET "seqfrout="
94+
)
95+
) ELSE (
96+
echo [ Video length is: !vlen! seconds
97+
)
5598

56-
:End
57-
ECHO [---------------------------------------------------------------------------------]
58-
ECHO [ SERVED ]
59-
ECHO [---------------------------------------------------------------------------------]
99+
ECHO [ Transcoding %%i of %argCount%: !argFile[%%i].trname!
100+
"%ffpath%ffmpeg.exe" !wset.params! !seqfr! -i "!argFile[%%i].name!" !wset.videocomp! !wset.audiocomp! !seqfrout! !wset.over! "!argFile[%%i].trname!"!wset.suff!
101+
)
60102

61-
if %pse% GTR 0 PAUSE
103+
ECHO [-----------------------------------------------------------------------------------]
104+
ECHO [ SERVED ]
105+
ECHO [-----------------------------------------------------------------------------------]
62106

63-
rem the main settings are defined in file sendtoffmpeg_settings.cmd, read the description inside it
107+
:End
108+
if %pse% GTR 0 PAUSE

0 commit comments

Comments
 (0)