Skip to content

Commit

Permalink
presets update
Browse files Browse the repository at this point in the history
color management disabled by default
a few preset updates
  • Loading branch information
keerah committed Nov 18, 2024
1 parent 51319eb commit af18443
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 11 deletions.
107 changes: 107 additions & 0 deletions mpv_play_25fps.bat
Original file line number Diff line number Diff line change
@@ -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
)
2 changes: 1 addition & 1 deletion sendtoffmpeg_settings.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions to apng 640px 15fps loop.bat → to apng x640 15fps loop.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
51 changes: 51 additions & 0 deletions to jpeg 422 x512 r10 1fps thumbnails.bat
Original file line number Diff line number Diff line change
@@ -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
64 changes: 64 additions & 0 deletions to libx vp9 webm 420 crf20 film ogg128k.bat
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand All @@ -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"
Expand All @@ -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 ================================================================================================

Expand Down

0 comments on commit af18443

Please sign in to comment.