From af18443aed28358e424209fe58fe7e268da0b6c8 Mon Sep 17 00:00:00 2001 From: Keerah <9025818+keerah@users.noreply.github.com> Date: Mon, 18 Nov 2024 02:48:22 -0500 Subject: [PATCH] presets update color management disabled by default a few preset updates --- mpv_play_25fps.bat | 107 ++++++++++++++++++ sendtoffmpeg_settings.cmd | 2 +- ...ps loop.bat => to apng x640 15fps loop.bat | 4 +- ...> to jpeg 422 x256 r15 1fps thumbnails.bat | 6 +- to jpeg 422 x512 r10 1fps thumbnails.bat | 51 +++++++++ to libx vp9 webm 420 crf20 film ogg128k.bat | 64 +++++++++++ ...o libx vp9 webm 420 crf40 film ogg128k.bat | 10 +- 7 files changed, 233 insertions(+), 11 deletions(-) create mode 100644 mpv_play_25fps.bat rename to apng 640px 15fps loop.bat => to apng x640 15fps loop.bat (97%) rename to jpeg 422 x256 r20 1fps thumbnails.bat => to jpeg 422 x256 r15 1fps thumbnails.bat (96%) create mode 100644 to jpeg 422 x512 r10 1fps thumbnails.bat create mode 100644 to libx vp9 webm 420 crf20 film ogg128k.bat rename to libx vp9 webm 420 crf20 film y720 ogg128k.bat => to libx vp9 webm 420 crf40 film ogg128k.bat (96%) diff --git a/mpv_play_25fps.bat b/mpv_play_25fps.bat new file mode 100644 index 0000000..a11c0b4 --- /dev/null +++ b/mpv_play_25fps.bat @@ -0,0 +1,107 @@ +@ECHO OFF + +TITLE MPV sequence player + +SET "mpv.path=C:\Users\Keerah\AppData\Local\Programs\mpv\" +SET /A mpv.fps=25 +SET /A mpv.sequence.counter=4 +SET /A "mpv.sequence.delim=_" + +SET "mpv.file.name=%~f1" +SET "mpv.file.trname=%~n1" +SET "mpv.file.ext=%~x1" +SET "mpv.file.path=%~dp1" + +SETLOCAL ENABLEDELAYEDEXPANSION + +REM Detecting the counter + +IF DEFINED mpv.file.name ( + IF EXIST "%mpv.file.name%" ( + IF !mpv.sequence.counter! GTR 0 ( + SET "basename=!mpv.file.trname:~0,-%mpv.sequence.counter%!" + SET "countername=!mpv.file.trname:~-%mpv.sequence.counter%!" + + SET "middelim=" + SET /A frnumber=-1 + + REM Constructing zero pattern + SET "zer=" + FOR /L %%I IN (1,1,!mpv.sequence.counter!) DO SET "zer=!zer!0" + + IF !countername!==!zer! ( + REM Zero frame + SET /A frnumber=0 + ECHO Frame counter detected at the end of the filename, digits: !mpv.sequence.counter!. + ) ELSE ( + REM Validating frame number at the end + SET "ddet=" + FOR /F "delims=0123456789" %%I IN ("!countername!") DO SET ddet=%%i + IF DEFINED ddet ( + REM Not a number + ECHO The last !mpv.sequence.counter! symbols of the filename is not a number. + IF DEFINED mpv.sequence.delim ( + REM Try to use delimiter + FOR /f "tokens=1-3 delims=%mpv.sequence.delim%" %%A in ("!mpv.file.trname!") do ( + SET "beforedelim=%%A" + SET "middelim=%%B" + SET "afterdelim=%%C" + ) + REM Limiting the counter. Lazy way, will consider string length calculation in future to get all digits + SET "middelimtr=!middelim:~0,%mpv.sequence.counter%!" + + REM Validating frame number after delimiter + SET "ddet=" + FOR /F "delims=0123456789" %%I IN ("!middelimtr!") DO SET ddet=%%i + IF DEFINED ddet ( + ECHO No frame counter found after delimiter "!mpv.sequence.delim!". No image sequence assumed. + ) ELSE ( + ECHO Frame counter detected after delimiter "!mpv.sequence.delim!", digits: !mpv.sequence.counter!. + REM Removing leading zeroes (if any) + FOR /F "tokens=* delims=0" %%N IN ("!middelimtr!") DO SET "frnumbername=%%N" + SET /A "frnumber=!frnumbername!" + ) + ) ELSE ( + ECHO Delimiter symbol is set to empty, no sequence detection. + SET /A frnumber=-1 + SET "wset.in.sequence.range=" + SET "wset.out.sequence.range=-update 1 -frames:v 1" + ) + ) ELSE ( + ECHO Frame counter detected at the end of the filename, digits: !mpv.sequence.counter!. + REM Removing leading zeroes (if any) + FOR /F "tokens=* delims=0" %%N IN ("!countername!") DO SET "frnumbername=%%N" + SET /A "frnumber=!frnumbername!" + ) + ) + + IF !frnumber! GTR -1 ( + IF NOT DEFINED middelim ( + REM Constructing the pattern in the end of the name + SET "mpv.file.pat=!basename!*" + ) ELSE ( + REM Constructing the pattern after the delimiter + REM If middelim was trimmed to mpv.sequence.counter = add the trimmed part to filename + IF !middelim! == !middelimtr! (SET "midsfx=") ELSE (SET midsfx=!middelim:~%mpv.sequence.counter%!) + SET "mpv.file.pat=!beforedelim!!mpv.sequence.delim!*!mpv.sequence.delim!!afterdelim!" + SET "basename=!beforedelim!" + ) + ECHO Basename: "!basename!", start frame: !frnumber!, pattern: "!mpv.file.pat!!mpv.file.ext!" + REM Replace counter with the pattern + SET "mpv.file.name=!mpv.file.path!!mpv.file.pat!!mpv.file.ext!" + + ) + + REM Playing + ECHO Let's play at !mpv.fps! fps... + "!mpv.path!mpv.exe" "!mpv.file.name!" "--merge-files=yes" "--no-correct-pts" "--fps=!mpv.fps!" "--idle=yes" "--loop=inf" "--title=Playing !mpv.file.name!" + + ) ELSE ( + ECHO The counter length is not set or zero + ) + ) ELSE ( + ECHO The file was not found + ) +) ELSE ( + ECHO No file specified +) \ No newline at end of file diff --git a/sendtoffmpeg_settings.cmd b/sendtoffmpeg_settings.cmd index 20e51d7..7dd99c4 100644 --- a/sendtoffmpeg_settings.cmd +++ b/sendtoffmpeg_settings.cmd @@ -56,7 +56,7 @@ REM After the code fails to find frame numbers in the end of the filename, it REM to find the first delimiter symbol and detect if there's frame number after it. REM Set this to SET "frdelim=" (empty string) if you do not want this detection to run. -SET "stf.cm.on=1" +SET "stf.cm.on=0" REM Color managment toggle REM If set to 1 the color management is on diff --git a/to apng 640px 15fps loop.bat b/to apng x640 15fps loop.bat similarity index 97% rename from to apng 640px 15fps loop.bat rename to to apng x640 15fps loop.bat index 8b841bd..30147f8 100644 --- a/to apng 640px 15fps loop.bat +++ b/to apng x640 15fps loop.bat @@ -4,9 +4,9 @@ REM Download from https://github.com/keerah/SendTo_FFmpeg REM animated png compatible preset REM === compression settings ======================================================================= -SET "wset.out.video.scale.x=640" +SET "wset.out.video.scale.x=-1" REM -1 is to scale proportionally, -2 to also keep it to multiple of 2. Leave empty to disable scaling -SET "wset.out.video.scale.y=-1" +SET "wset.out.video.scale.y=640" REM Scales to fit vertically to 540px. Leave empty to disable scaling SET "wset.out.video.scale.algo=lanczos" REM bilinear, bicubic, bicublin, gauss, sinc, lanczos, spline and more https://ffmpeg.org/ffmpeg-scaler.html. Can be combined using + diff --git a/to jpeg 422 x256 r20 1fps thumbnails.bat b/to jpeg 422 x256 r15 1fps thumbnails.bat similarity index 96% rename from to jpeg 422 x256 r20 1fps thumbnails.bat rename to to jpeg 422 x256 r15 1fps thumbnails.bat index 52b3999..1a76cf1 100644 --- a/to jpeg 422 x256 r20 1fps thumbnails.bat +++ b/to jpeg 422 x256 r15 1fps thumbnails.bat @@ -4,13 +4,13 @@ REM Download from https://github.com/keerah/SendTo_FFmpeg REM jpeg compatible preset REM === compression settings ======================================================================= -SET "wset.out.video.rate=20" +SET "wset.out.video.rate=15" REM mjpeg codec supports: 2 - 32 (high to low quality) SET "wset.out.video.fps=1" REM Output framerate in Hz. 1 is to output 1 frame per second. Leave empty for no change. Set to negative value to override input framerate to the Abs(fps), this is useful for Gifs to presere all frames but change speed -SET "wset.out.video.scale.x=256" +SET "wset.out.video.scale.x=-1" REM Leave empty to disable scaling. -1 is to scale proportionally, -2 to also keep it to multiple of 2 -SET "wset.out.video.scale.y=-1" +SET "wset.out.video.scale.y=256" REM Leave empty to disable scaling. -1 is to scale proportionally, -2 to also keep it to multiple of 2 SET "wset.out.video.scale.algo=lanczos" REM bilinear, bicubic, bicublin, gauss, sinc, lanczos, spline and more https://ffmpeg.org/ffmpeg-scaler.html diff --git a/to jpeg 422 x512 r10 1fps thumbnails.bat b/to jpeg 422 x512 r10 1fps thumbnails.bat new file mode 100644 index 0000000..075ea84 --- /dev/null +++ b/to jpeg 422 x512 r10 1fps thumbnails.bat @@ -0,0 +1,51 @@ +@ECHO OFF +REM SendTo_FFmpeg is an FFmpeg based set of batch scripts for transcoding +REM Download from https://github.com/keerah/SendTo_FFmpeg +REM jpeg compatible preset + +REM === compression settings ======================================================================= +SET "wset.out.video.rate=10" + REM mjpeg codec supports: 2 - 32 (high to low quality) +SET "wset.out.video.fps=1" + REM Output framerate in Hz. 1 is to output 1 frame per second. Leave empty for no change. Set to negative value to override input framerate to the Abs(fps), this is useful for Gifs to presere all frames but change speed +SET "wset.out.video.scale.x=-1" + REM Leave empty to disable scaling. -1 is to scale proportionally, -2 to also keep it to multiple of 2 +SET "wset.out.video.scale.y=512" + REM Leave empty to disable scaling. -1 is to scale proportionally, -2 to also keep it to multiple of 2 +SET "wset.out.video.scale.algo=lanczos" + REM bilinear, bicubic, bicublin, gauss, sinc, lanczos, spline and more https://ffmpeg.org/ffmpeg-scaler.html +SET "wset.out.format=.jpg" +SET "wset.out.video.codec=mjpeg" +SET "wset.out.video.sampling=yuvj422p" + REM mjpeg supports: yuvj444p, yuvj420p, yuvj422p, yuv420p, yuv422p, yuv444p +SET "wset.out.params=-hide_banner -stats" +SET "wset.out.sequence=1" + +REM === color management settings ================================================================== +SET "wset.in.cm.space=bt709" +SET "wset.in.cm.primaries=bt709" +SET "wset.in.cm.transfer=bt709" +SET "wset.in.cm.range=tv" +SET "wset.out.cm.space=bt709" +SET "wset.out.cm.primaries=bt709" +SET "wset.out.cm.transfer=bt709" +SET "wset.out.cm.range=tv" + REM Leave the cm.space empty to disable management for input/output. Color spaces: rgb, bt709, fcc, bt470bg, bt2020nc, bt2020c, smpte170m, smpte240m. Ranges: pc, tv, mpeg, jpeg. Primaries: bt709, bt470m, bt470bg, bt2020, film, smpte170m, smpte240m. Transforms: bt709, gamma22, gamma28, linear, log, log_sqrt, bt2020_10, bt2020_12, smpte170m, smpte240m. For full list refer to https://ffmpeg.org/ffmpeg-codecs.html +REM ================================================================================================ + +COLOR 0F +SETLOCAL ENABLEDELAYEDEXPANSION +SET /A stf.result=0 +SET /A stf.pause=1 + +IF EXIST "%~dp0sendtoffmpeg_run.cmd" ( + SET "wset.out.type=03" + CALL "%~dp0sendtoffmpeg_run.cmd" %* +) ELSE ( + SET /A stf.result=5 + ECHO Sorry, the sendtoffmpeg_run.cmd module is unreacheable. Unable to continue^^! +) + +IF %stf.result% GTR 0 ECHO Result code is %stf.result% +ECHO. +if NOT %stf.pause% == 0 PAUSE \ No newline at end of file diff --git a/to libx vp9 webm 420 crf20 film ogg128k.bat b/to libx vp9 webm 420 crf20 film ogg128k.bat new file mode 100644 index 0000000..f71073e --- /dev/null +++ b/to libx vp9 webm 420 crf20 film ogg128k.bat @@ -0,0 +1,64 @@ +@ECHO OFF +REM SendTo_FFmpeg is an FFmpeg based set of batch scripts for transcoding +REM Download from https://github.com/keerah/SendTo_FFmpeg +REM vp compatible preset + +REM === compression settings ======================================================================= +SET "wset.out.video.rate=20" + REM copy to copy the stream, libvpx-vp9 crf supports: -1 to 63 +SET "wset.out.audio.rate=128k" + REM 64k, 96k, 128k, 256k, 320k, copy to copy the stream, leave empty to disable audio +SET "wset.out.video.scale.x=" + REM Leave empty to disable scaling. -1 is to scale proportionally, -2 to also keep it to multiple of 2 +SET "wset.out.video.scale.y=" + REM Leave empty to disable scaling. -1 is to scale proportionally, -2 to also keep it to multiple of 2 +SET "wset.out.video.scale.algo=lanczos" + REM bilinear, bicubic, bicublin, gauss, sinc, lanczos, spline and more https://ffmpeg.org/ffmpeg-scaler.html. Can be combined using + +SET "wset.out.video.fps=" + REM Output framerate in Hz. 1 is to output 1 frame per second. Leave empty for no change. Set to negative value to override input framerate to the Abs(fps), this is useful for Gifs to presere all frames but change playback speed +SET "wset.out.format=.webm" +SET "wset.out.video.codec=libvpx-vp9" + REM h264_nvenc, hevc_nvenc - CUDA h264, h265 encoders. h264_qsv, hevc_qsv - Intel Quick Sync h264, h265 encoders. libvpx, libvpx-vp9, vp9_qsv - vp8, vp9 codecs. libx264, libx265dnxhd, prores, prores_aw, prores_ks, rawvideo. Use "ffmpeg -ecncoders" command to list. Other codecs may have requirements not compatible with this preset +SET "wset.out.video.sampling=yuv420p" + REM libvpx-vp9 supports: yuv420p yuva420p yuv422p yuv440p yuv444p yuv420p10le yuv422p10le yuv440p10le yuv444p10le yuv420p12le yuv422p12le yuv440p12le yuv444p12le gbrp gbrp10le gbrp12le +SET "wset.out.video.preset=best" + REM libvpx-vp9 supports: good, best, realtime +SET "wset.out.video.tune=film" + REM libvpx-vp9 supports: default, screen, film +SET "wset.out.audio.codec=libvorbis" + REM aac, aac_mf, alac, flac, mp3_mf, opus, pcm_s16le, pcm_s24le, vorbis. Use "ffmpeg -ecncoders" command to list. Other codecs may have requirements not compatible with this preset +SET "wset.out.audio.sampling=" + REM Not used yet. aac supports: 96000 88200 64000 48000 44100 32000 24000 22050 16000 12000 11025 8000 7350 +SET "wset.in.audio.file.extension=.wav" + REM If the file extension is defined here (eg .wav), the audio file with the same name as the source's but with this extension will be added as audio to the output. Use uncompressed audio like wav for faster and more precise muxing +SET "wset.out.params=-hide_banner -stats" +SET "wset.out.sequence=0" + +REM === color management settings ================================================================== +SET "wset.in.cm.space=bt709" +SET "wset.in.cm.primaries=bt709" +SET "wset.in.cm.transfer=bt709" +SET "wset.in.cm.range=pc" +SET "wset.out.cm.space=bt709" +SET "wset.out.cm.primaries=bt709" +SET "wset.out.cm.transfer=bt709" +SET "wset.out.cm.range=pc" + REM Leave the cm.space empty to disable management for input/output. Color spaces: rgb, bt709, fcc, bt470bg, bt2020nc, bt2020c, smpte170m, smpte240m. Ranges: pc, tv, mpeg, jpeg. Primaries: bt709, bt470m, bt470bg, bt2020, film, smpte170m, smpte240m. Transforms: bt709, gamma22, gamma28, linear, log, log_sqrt, bt2020_10, bt2020_12, smpte170m, smpte240m. For full list refer to https://ffmpeg.org/ffmpeg-codecs.html +REM ================================================================================================ + +COLOR 0F +SETLOCAL ENABLEDELAYEDEXPANSION +SET /A stf.result=0 +SET /A stf.con.pause=1 + +IF EXIST "%~dp0sendtoffmpeg_run.cmd" ( + SET "wset.out.type=07" + CALL "%~dp0sendtoffmpeg_run.cmd" %* +) ELSE ( + SET /A stf.result=5 + ECHO Sorry, the sendtoffmpeg_run.cmd module is unreacheable. Unable to continue^^! +) + +IF %stf.result% GTR 0 ECHO Result code is %stf.result% +ECHO. +if NOT %stf.con.pause% == 0 PAUSE \ No newline at end of file diff --git a/to libx vp9 webm 420 crf20 film y720 ogg128k.bat b/to libx vp9 webm 420 crf40 film ogg128k.bat similarity index 96% rename from to libx vp9 webm 420 crf20 film y720 ogg128k.bat rename to to libx vp9 webm 420 crf40 film ogg128k.bat index 2107f92..3af73ca 100644 --- a/to libx vp9 webm 420 crf20 film y720 ogg128k.bat +++ b/to libx vp9 webm 420 crf40 film ogg128k.bat @@ -4,13 +4,13 @@ REM Download from https://github.com/keerah/SendTo_FFmpeg REM vp compatible preset REM === compression settings ======================================================================= -SET "wset.out.video.rate=40" +SET "wset.out.video.rate=30" REM copy to copy the stream, libvpx-vp9 crf supports: -1 to 63 SET "wset.out.audio.rate=128k" REM 64k, 96k, 128k, 256k, 320k, copy to copy the stream, leave empty to disable audio SET "wset.out.video.scale.x=-2" REM Leave empty to disable scaling. -1 is to scale proportionally, -2 to also keep it to multiple of 2 -SET "wset.out.video.scale.y=720" +SET "wset.out.video.scale.y=" REM Leave empty to disable scaling. -1 is to scale proportionally, -2 to also keep it to multiple of 2 SET "wset.out.video.scale.algo=lanczos" REM bilinear, bicubic, bicublin, gauss, sinc, lanczos, spline and more https://ffmpeg.org/ffmpeg-scaler.html. Can be combined using + @@ -29,7 +29,7 @@ SET "wset.out.audio.codec=libvorbis" REM aac, aac_mf, alac, flac, mp3_mf, opus, pcm_s16le, pcm_s24le, vorbis. Use "ffmpeg -ecncoders" command to list. Other codecs may have requirements not compatible with this preset SET "wset.out.audio.sampling=" REM Not used yet. aac supports: 96000 88200 64000 48000 44100 32000 24000 22050 16000 12000 11025 8000 7350 -SET "wset.in.audio.file.extension=" +SET "wset.in.audio.file.extension=.wav" REM If the file extension is defined here (eg .wav), the audio file with the same name as the source's but with this extension will be added as audio to the output. Use uncompressed audio like wav for faster and more precise muxing SET "wset.out.params=-hide_banner -stats" SET "wset.out.sequence=0" @@ -38,11 +38,11 @@ REM === color management settings ============================================== SET "wset.in.cm.space=bt709" SET "wset.in.cm.primaries=bt709" SET "wset.in.cm.transfer=bt709" -SET "wset.in.cm.range=tv" +SET "wset.in.cm.range=pc" SET "wset.out.cm.space=bt709" SET "wset.out.cm.primaries=bt709" SET "wset.out.cm.transfer=bt709" -SET "wset.out.cm.range=tv" +SET "wset.out.cm.range=pc" REM Leave the cm.space empty to disable management for input/output. Color spaces: rgb, bt709, fcc, bt470bg, bt2020nc, bt2020c, smpte170m, smpte240m. Ranges: pc, tv, mpeg, jpeg. Primaries: bt709, bt470m, bt470bg, bt2020, film, smpte170m, smpte240m. Transforms: bt709, gamma22, gamma28, linear, log, log_sqrt, bt2020_10, bt2020_12, smpte170m, smpte240m. For full list refer to https://ffmpeg.org/ffmpeg-codecs.html REM ================================================================================================