Skip to content

Commit

Permalink
v3.15
Browse files Browse the repository at this point in the history
New tool to auto-create shortcuts to the scripts in the SendTo menu.
Some minor fixes.
  • Loading branch information
keerah committed Feb 22, 2023
1 parent 2974e78 commit 7f1f8bc
Show file tree
Hide file tree
Showing 47 changed files with 291 additions and 137 deletions.
101 changes: 101 additions & 0 deletions Create_SendTo_Shortcuts.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
@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 v3.15

SET "divline=-----------------------------------------------------------------------------------------------"

ECHO %divline%
ECHO This is an installation script for SendTo_FFmpeg batches.
ECHO Make sure you're running this script from the folder that is going to keep the presets present all the time.
ECHO The script will create shortcuts to all of the presets and will put them into Windows SendTo folder.
ECHO You can remove the unnecessary ones after that. The new Explorer window with that folder will be open for you.
ECHO You will be prompted to overwrite shortcuts if they're already exist.
ECHO %divline%

ECHO.
PAUSE
ECHO.

setlocal enabledelayedexpansion

REM Path to icon. You can change this path to an .ico file as well.
SET "iconpath=%WINDIR%\System32\shell32.dll,115"

SET "lnksource=%~dp0"
SET "SCRIPT=%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"
SET "lnkdir=%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-shortcuts"
SET "stfolder=%USERPROFILE%\AppData\Roaming\Microsoft\Windows\SendTo"

MKDIR "%lnkdir%"

IF EXIST %stfolder% (

ECHO %divline%
ECHO The current folder is: %lnksource%
ECHO Stage 1/3
ECHO Getting the preset list...

SET /A cnt=0
FOR /F "tokens=1 delims=" %%F IN ('dir /b /a-d "to *.bat"') DO (
SET /A cnt=!cnt!+1
SET "prs[!cnt!].file=%%F"
CALL SET "prs[!cnt!].arr=Prs^(!cnt!^) = "%%prs[!cnt!].file:.bat=%%""
)
ECHO !cnt! presets found.
ECHO %divline%

IF !cnt! GEQ 0 (

ECHO Stage 2/3
ECHO Creating shortcuts...

ECHO Dim Prs^(!cnt!^) >> %SCRIPT%

FOR /L %%I IN (1,1,!cnt!) DO (
ECHO Preset #%%I: "!prs[%%I].file!"
ECHO !prs[%%I].arr! >> %SCRIPT%
)

ECHO For I = 1 to !cnt! >> %SCRIPT%
ECHO Set oWS = WScript.CreateObject^("WScript.Shell"^) >> %SCRIPT%
ECHO Set oLink = oWS.CreateShortcut^("%lnkdir%" + "\" + Prs^(I^)^ + ".lnk"^) >> %SCRIPT%
ECHO oLink.IconLocation = "%iconpath%" >> %SCRIPT%
ECHO oLink.TargetPath = "%lnksource%" + Prs^(I^) + ".bat" >> %SCRIPT%
ECHO oLink.WorkingDirectory ="" >> %SCRIPT%
ECHO oLink.Save >> %SCRIPT%
ECHO Next >> %SCRIPT%

cscript /nologo "%SCRIPT%"
IF EXIST "%SCRIPT%" DEL "%SCRIPT%"
ECHO %divline%

ECHO Stage 3/3
ECHO Moving the sortucuts...
ECHO The SendTo folder is: "%stfolder%"

MOVE /-Y "%lnkdir%\*.lnk" "%stfolder%"
RMDIR /S /Q "%lnkdir%"

ECHO %divline%
ECHO The SendTo folder will now open.
ECHO That's all. Enjoy^!
ECHO %divline%
EXPLORER "%stfolder%"
) ELSE (

ECHO No presets were found in the current folder.
ECHO Make sure you're running this script from the folder that contains the downloaded SendTo_FFmpeg files.
ECHO %divline%
)
) ELSE (
ECHO %divline%
ECHO Unable to locate the SendTo folder^!
ECHO The path "%stfolder%" does not exist.
ECHO %divline%
)

endlocal
ECHO.
PAUSE
EXIT
29 changes: 8 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,23 @@ This is a set of Windows **batch** scripts that can transcode mostly everything

# Installation

First click `Code` -> `Donwload ZIP` on this page or downlad from the [releases page](https://github.com/keerah/SendTo_FFmpeg/releases) to get all the scripts, it's all yours for free and forever.
First click `Code` -> `Donwload ZIP` on this page or downlad from the [releases page](https://github.com/keerah/SendTo_FFmpeg/releases) to get all the scripts, it's all yours for free and forever. Unpack the downloaded zip to any convenient location where these presets will stay present.

Then you will need to [download the FFmpeg executables](https://ffmpeg.org/download.html#build-windows) or from [here on Github](https://github.com/BtbN/FFmpeg-Builds/releases), it's free as well.

By default these scripts assume the path to FFmpeg.exe is `c:\Program Files\ffmpeg\bin`, so you can simply extract the downloaded ffmpeg archive into `c:\Program Files\ffmpeg`. If you place ffmpeg into a different folder, you will need to edit the `ffpath` option in the settings file named `sendtoffmpeg_settings.cmd`. There's a full description for each option in that file.

# Usage
You can use these batches in a few different ways:

## Drag-n-drop
Just drag your files over the corresponding `.bat` file's icon. You can drag files one by one, each will be encoded in a separate process, you can also select multiple files for any script except a couple. Each script announces its features and reports about the process, so keep an eye on the output.

## Windows explorer's Send To menu
You can integrate these batches as commands into Windows' `Send To` menu (right-click on any file in the Explorer).

For this you will need to:

1. Put all of these batches to any convenient location (for example in cloud sync folder to have them synced for all machines). Find the file named `sendtoffmpeg_settings`.cmd_ and edit it to change the `ffpath` option, that points to the **FFmpeg** executables, if this path is different from `c:\Program Files\ffmpeg`.

2. Now create the shortcuts for these files (Alt-drag them onto your Desktop first). Then move these shortcuts into `C:\Users\[_YOUR USER NAME_]\AppData\Roaming\Microsoft\Windows\SendTo` folder (this will require elevated privileges).
You can integrate these batches into Windows' `Send To` menu (right-click on any file in the Explorer). Now it's automated and easy to do.

3. Now you may want to rename these shortcuts to get rid of the `Shortcut` word in the names, or rename them to whatever siuts your needs, but do not change the `.lnk` extension.
Just run the file `Create_SendTo_Shortcuts.bat` by double-clicking it and follow instructions. It will create all the shortcut files for you and will open the folder containing them. There's plenty of presets already and you might decide to remove some of the links to unclutter the menu.

4. And finally you will have to manually clear the `Start In` field in each shortcut (this lets the scripts save output files next to your sources) by right-clicking one after another and selecting the `Properties` menu. Along with it you can change the icon of the shortcuts (`Change Icon` button in the same Properties window), these icons will let you identify the tasks in the `Send To` menu. This takes time, but a backup of those will serve you well later.
That's all. Now you can right-click on any file(s), navigate to `Send To` menu item and select one of the presets there. The corresponding `.bat` file will do the rest and will place the result into the same folder with a suffix like `_CUDA_420_high.mp4` added to the filename(s).

That's all. Now you can right-click on any file(s), navigate to `Send To` menu item and select one of the presets there. The corresponding `.bat` file will do the rest and will place the result into the same folder with a suffix like `_CUDA_420_high.mp4` added to the filename(s) (if descriptive names option `dscr` is enabled).

## Shell

Use it in CMD, Powershell or Terminal as usual.
## Drag-n-drop
Just drag your files over the corresponding `.bat` file's icon. You can drag files one by one, each will be encoded in a separate process, you can also select multiple files for any script except a couple. Each script announces its features and reports about the process, so keep an eye on the output.

# User settings

Expand All @@ -48,10 +35,10 @@ You can have very different settings for your current (and any other) folder by

- To transcode an image sequence you need to select the first frame of the sequence(s), or any other frame to trim the sequence(s).
- **SendTo** will look for the frame counter at the end of the filename first, it will consider the number of ending symbols defined by `frcounter` setting, which by default is `4`.
- If the frame counter was not found at the end of the filename **SendTo** will attempt to find the counter after the delimiter symbol, which is defined by the setting `frdelim` (Framecounter delimiter) and by default is set to `.`. If it is set to empty string `SET "frdelim="` then this detection is skipped. This feature lets you encode the sequences named like this _`Renderout.0001.puzzleMatte.exr`_.
- If all attempts to detect the frame counter fail, you will get a single frame output.
- If you select a few frames that belong to different sequences, they will be transcoded independently. If you select a few images of the same image sequence you will get separate outputs for each with different in-point.
- You can supress the sequence detection by changing the `imgset` (Consider image sequences) option to `0` in the settings file. Do not forget you can do it for just one particular folder(s) by copying the settings file into this folder and changing this option in it.
- If the frame counter was not found at the end of the filename **SendTo** will attempt to find the counter after the delimiter symbol, which is defined by the setting `frdelim` (Framecounter delimiter) and by default is set to `.`. If it is set to empty string `SET "frdelim="` then this detection is skipped. This feature lets you encode the sequences named like this _`Renderout.0001.puzzleMatte.exr`_.
- If all attempts to detect the frame counter fails, you will get a single frame output.

# Limitations

Expand Down
7 changes: 4 additions & 3 deletions sendtoffmpeg_encoder01.cmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
REM SendTo_FFmpeg is an FFmpeg based set of batch scripts for transcoding
REM Download from https://github.com/keerah/SendTo_FFmpeg
REM This is one of the SenTo FFmpeg modular transcoders, keep it with the rest of the files
REM v3.11

ECHO %divline%
ECHO SendTo FFmpeg encoder v3.11 by Keerah
ECHO SendTo FFmpeg encoder v3.15 by Keerah
ECHO %wset.hline1%
IF NOT "[%wset.hline2%]"=="[]" ECHO %wset.hline2%
ECHO %wset.hline3%
Expand Down Expand Up @@ -80,7 +81,7 @@ FOR /L %%i IN (1,1,%argCount%) DO (
ECHO Basename:"!basename!", start frame:!frnumber!, pattern:"!basename!%%0%frcounter%d"
) ELSE (
REM Constructing the pattern after the delimiter
REM !!! Needs a fix if middelim was trimmed to frcounter = add the trimmed part to filename!!!
REM If middelim was trimmed to frcounter = add the trimmed part to filename
IF !middelim! == !middelimtr! (SET "midsfx=") ELSE (SET midsfx=!middelim:~%frcounter%!)
SET "argFile[%%i].name=!argFile[%%i].path!!beforedelim!%frdelim%%%0%frcounter%d!midsfx!%frdelim%!afterdelim!!argFile[%%i].ext!"
ECHO Basename:"!beforedelim!", start frame:!frnumber!, pattern:"!beforedelim!%frdelim%%%0%frcounter%d!midsfx!%frdelim%!afterdelim!"
Expand Down
7 changes: 4 additions & 3 deletions sendtoffmpeg_encoder02.cmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
REM SendTo_FFmpeg is an FFmpeg based set of batch scripts for transcoding
REM Download from https://github.com/keerah/SendTo_FFmpeg
REM This is one of the SenTo FFmpeg modular transcoders, keep it with the rest of the files
REM v3.11

ECHO %divline%
ECHO SendTo FFmpeg encoder v3.11 by Keerah
ECHO SendTo FFmpeg encoder v3.15 by Keerah
ECHO %wset.hline1%
IF NOT "[%wset.hline2%]"=="[]" ECHO %wset.hline2%
ECHO %wset.hline3%
Expand Down Expand Up @@ -80,7 +81,7 @@ FOR /L %%i IN (1,1,%argCount%) DO (
ECHO Basename:"!basename!", start frame:!frnumber!, pattern:"!basename!%%0%frcounter%d"
) ELSE (
REM Constructing the pattern after the delimiter
REM !!! Needs a fix if middelim was trimmed to frcounter = add the trimmed part to filename!!!
REM If middelim was trimmed to frcounter = add the trimmed part to filename
IF !middelim! == !middelimtr! (SET "midsfx=") ELSE (SET midsfx=!middelim:~%frcounter%!)
SET "argFile[%%i].name=!argFile[%%i].path!!beforedelim!%frdelim%%%0%frcounter%d!midsfx!%frdelim%!afterdelim!!argFile[%%i].ext!"
ECHO Basename:"!beforedelim!", start frame:!frnumber!, pattern:"!beforedelim!%frdelim%%%0%frcounter%d!midsfx!%frdelim%!afterdelim!"
Expand Down
6 changes: 3 additions & 3 deletions sendtoffmpeg_settings.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
REM SendTo_FFmpeg is a set of windows batches for effortless transcoding
REM SendTo_FFmpeg is an FFmpeg based set of batch scripts for transcoding
REM Download from https://github.com/keerah/SendTo_FFmpeg
REM v 3.05
REM v3.15

REM This is a SendTo_FFmpeg settings file
REM You have to be careful here, cause it's an executable part of the scripts
Expand All @@ -13,7 +13,7 @@ REM For example, you can disable the descriptive name suffixes,
REM use another default framerate or even use another FFmpeg version
REM for a particular folder only

SET "ffpath=c:\Program Files\ffmpeg\bin\"
SET "ffpath=c:\Program Files\ffmpeg\bin0\"
REM Path to ffmpeg.exe
REM will also look for exiftool.exe here when needed

Expand Down
15 changes: 8 additions & 7 deletions to APNG forever loop.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@ECHO OFF
REM SendTo_FFmpeg is a set of windows batches for effortless transcoding
REM SendTo_FFmpeg is an FFmpeg based set of batch scripts for transcoding
REM Download from https://github.com/keerah/SendTo_FFmpeg

setlocal enabledelayedexpansion
Expand All @@ -13,12 +13,6 @@ FOR %%f IN (%*) DO (
SET "argFile[!argCount!].path=%%~dpf"
)

IF %argCount% LEQ 0 (
ECHO %divline%
ECHO NO FILE^(S^) SPECIFIED
GOTO :End
)

SET "cmdp=%~dp0"
SET "argp=%~dp1"

Expand All @@ -36,6 +30,13 @@ IF EXIST "%argp%sendtoffmpeg_settings.cmd" (
)
)

IF %argCount% LEQ 0 (
ECHO %divline%
ECHO NO FILE^(S^) SPECIFIED
ECHO %divline%
GOTO :End
)

REM Check for ffmpeg
IF NOT EXIST "%ffpath%ffmpeg.exe" (
ECHO ! Sorry, the path to ffmpeg.exe is unreacheable. Unable to continue!
Expand Down
4 changes: 3 additions & 1 deletion to CUDA h264 mp4 420 10Mbit aac128.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@ECHO OFF
REM SendTo_FFmpeg is a set of windows batches for effortless transcoding
REM SendTo_FFmpeg is an FFmpeg based set of batch scripts for transcoding
REM Download from https://github.com/keerah/SendTo_FFmpeg

setlocal enabledelayedexpansion
Expand Down Expand Up @@ -33,6 +33,7 @@ IF EXIST "%argp%sendtoffmpeg_settings.cmd" (
IF %argCount% LEQ 0 (
ECHO %divline%
ECHO NO FILE^(S^) SPECIFIED
ECHO %divline%
GOTO :End
)

Expand All @@ -53,6 +54,7 @@ IF %quietover% == 1 (SET "wset.over=-y") ELSE (SET "wset.over=")
IF %dscr% GTR 0 (SET "wset.dscr=_420_cuda_10Mbit_aac128") ELSE (SET "wset.dscr=")
SET "wset.suff=!wset.dscr!.mp4"


IF EXIST "%cmdp%sendtoffmpeg_encoder01.cmd" (
CALL "%cmdp%sendtoffmpeg_encoder01.cmd"
) ELSE (
Expand Down
4 changes: 3 additions & 1 deletion to CUDA h264 mp4 420 10Mbit copy.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@ECHO OFF
REM SendTo_FFmpeg is a set of windows batches for effortless transcoding
REM SendTo_FFmpeg is an FFmpeg based set of batch scripts for transcoding
REM Download from https://github.com/keerah/SendTo_FFmpeg

setlocal enabledelayedexpansion
Expand Down Expand Up @@ -33,6 +33,7 @@ IF EXIST "%argp%sendtoffmpeg_settings.cmd" (
IF %argCount% LEQ 0 (
ECHO %divline%
ECHO NO FILE^(S^) SPECIFIED
ECHO %divline%
GOTO :End
)

Expand All @@ -54,6 +55,7 @@ IF %quietover% == 1 (SET "wset.over=-y") ELSE (SET "wset.over=")
IF %dscr% GTR 0 (SET "wset.dscr=_420_cuda_4Mbit_aac96") ELSE (SET "wset.dscr=")
SET "wset.suff=!wset.dscr!.mp4"


IF EXIST "%cmdp%sendtoffmpeg_encoder01.cmd" (
CALL "%cmdp%sendtoffmpeg_encoder01.cmd"
) ELSE (
Expand Down
4 changes: 3 additions & 1 deletion to CUDA h264 mp4 420 1Mbit copy.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@ECHO OFF
REM SendTo_FFmpeg is a set of windows batches for effortless transcoding
REM SendTo_FFmpeg is an FFmpeg based set of batch scripts for transcoding
REM Download from https://github.com/keerah/SendTo_FFmpeg

setlocal enabledelayedexpansion
Expand Down Expand Up @@ -33,6 +33,7 @@ IF EXIST "%argp%sendtoffmpeg_settings.cmd" (
IF %argCount% LEQ 0 (
ECHO %divline%
ECHO NO FILE^(S^) SPECIFIED
ECHO %divline%
GOTO :End
)

Expand All @@ -54,6 +55,7 @@ IF %quietover% == 1 (SET "wset.over=-y") ELSE (SET "wset.over=")
IF %dscr% GTR 0 (SET "wset.dscr=_420_cuda_1Mbit") ELSE (SET "wset.dscr=")
SET "wset.suff=!wset.dscr!.mp4"


IF EXIST "%cmdp%sendtoffmpeg_encoder01.cmd" (
CALL "%cmdp%sendtoffmpeg_encoder01.cmd"
) ELSE (
Expand Down
4 changes: 3 additions & 1 deletion to CUDA h264 mp4 420 20Mbit aac192.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@ECHO OFF
REM SendTo_FFmpeg is a set of windows batches for effortless transcoding
REM SendTo_FFmpeg is an FFmpeg based set of batch scripts for transcoding
REM Download from https://github.com/keerah/SendTo_FFmpeg

setlocal enabledelayedexpansion
Expand Down Expand Up @@ -33,6 +33,7 @@ IF EXIST "%argp%sendtoffmpeg_settings.cmd" (
IF %argCount% LEQ 0 (
ECHO %divline%
ECHO NO FILE^(S^) SPECIFIED
ECHO %divline%
GOTO :End
)

Expand All @@ -53,6 +54,7 @@ IF %quietover% == 1 (SET "wset.over=-y") ELSE (SET "wset.over=")
IF %dscr% GTR 0 (SET "wset.dscr=_420_cuda_20Mbit_aac192") ELSE (SET "wset.dscr=")
SET "wset.suff=!wset.dscr!.mp4"


IF EXIST "%cmdp%sendtoffmpeg_encoder01.cmd" (
CALL "%cmdp%sendtoffmpeg_encoder01.cmd"
) ELSE (
Expand Down
4 changes: 3 additions & 1 deletion to CUDA h264 mp4 420 2Mbit aac96.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@ECHO OFF
REM SendTo_FFmpeg is a set of windows batches for effortless transcoding
REM SendTo_FFmpeg is an FFmpeg based set of batch scripts for transcoding
REM Download from https://github.com/keerah/SendTo_FFmpeg

setlocal enabledelayedexpansion
Expand Down Expand Up @@ -33,6 +33,7 @@ IF EXIST "%argp%sendtoffmpeg_settings.cmd" (
IF %argCount% LEQ 0 (
ECHO %divline%
ECHO NO FILE^(S^) SPECIFIED
ECHO %divline%
GOTO :End
)

Expand All @@ -53,6 +54,7 @@ IF %quietover% == 1 (SET "wset.over=-y") ELSE (SET "wset.over=")
IF %dscr% GTR 0 (SET "wset.dscr=_420_cuda_2Mbit_aac96") ELSE (SET "wset.dscr=")
SET "wset.suff=!wset.dscr!.mp4"


IF EXIST "%cmdp%sendtoffmpeg_encoder01.cmd" (
CALL "%cmdp%sendtoffmpeg_encoder01.cmd"
) ELSE (
Expand Down
4 changes: 3 additions & 1 deletion to CUDA h264 mp4 420 40Mbit aac320.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@ECHO OFF
REM SendTo_FFmpeg is a set of windows batches for effortless transcoding
REM SendTo_FFmpeg is an FFmpeg based set of batch scripts for transcoding
REM Download from https://github.com/keerah/SendTo_FFmpeg

setlocal enabledelayedexpansion
Expand Down Expand Up @@ -33,6 +33,7 @@ IF EXIST "%argp%sendtoffmpeg_settings.cmd" (
IF %argCount% LEQ 0 (
ECHO %divline%
ECHO NO FILE^(S^) SPECIFIED
ECHO %divline%
GOTO :End
)

Expand All @@ -53,6 +54,7 @@ IF %quietover% == 1 (SET "wset.over=-y") ELSE (SET "wset.over=")
IF %dscr% GTR 0 (SET "wset.dscr=_420_cuda_40Mbit_aac320") ELSE (SET "wset.dscr=")
SET "wset.suff=!wset.dscr!.mp4"


IF EXIST "%cmdp%sendtoffmpeg_encoder01.cmd" (
CALL "%cmdp%sendtoffmpeg_encoder01.cmd"
) ELSE (
Expand Down
Loading

0 comments on commit 7f1f8bc

Please sign in to comment.