Saturday, May 27, 2017

AutoBatcher (batch file generator)

Simply put, "AutoBatcher" (open source) is a batch file generator for processing files in a folder. It was written as a direct response to my own limited knowledge of batch scripting which I find alien [e.g. for %%a in ("*.*") <do stuff>].

The most typical scenario I usually find myself in is that I would write a batch file that would do some kind of processing with ffmpeg to media files in a folder of certain file extensions (mkv, mp4, mp3, etc). This quickly gets out of hand when you find that you have a rapidly growing collection of batch scripts (not necessarily limited to processing with ffmpeg or media files).

And since my limited knowledge of batch scrpting forced me to concede that batch files can't do everything, I wrote "BatFunk" to complement AutoBatcher. With BatFunk, you can make batch files do stuff like perform mathematical operations, pause/sleep for x seconds, compute elapsed time, make a decision using 'iif' (like 'If-Then-Else'), and, oh yeah, probe a video for information (requires ffprobe).

BatFunk example to get the duration of a video:
%batfunk% ffprobe "durationhms/ ""%ifull%""/ "%ffprobe%"" > %tempfile%

AutoBatcher's notable presets:

Irfanview Slide Show
    - Launches Irfanview after creating a list of found images.

M3U Music Play List
    - Launches VLC after creating an M3U play list file of found audio files.

Search and TeraCopy Movies (with log file)
    - Uses TeraCopy to copy videos. The corresponding log file (file, size, start, end, elapsed) will be opened with Notepad after batch processing.

Make Movies LOUDER (AAC in MKV)
Make Movies LOUDER (MP3 in AVI)
    - Because non-audiophiles do not want to be bad neighbors. Get louder whispers and less jarring explosions through dynamic compression (personal recipe). Lets you watch movies late at night on LOW volume on your TV, tablet, or phone without missing important plot points.

VTT to SRT (SubRip subtitle)
Extract subtitles from MKV
MP4 + SRT into MKV
    - Other ffmpeg examples.

Enhance Dull Pictures
    - Uses ffmpeg's filters to enhance still images (personal recipe).

Video Encode Example
    - Uses ffprobe to get video info. Uses ffmpeg to resize the video. Sets window title to "x/y ~ duration ~ file" (duration on window title is a good substitute for a progress bar). The generated batch file also creates a corresponding log file (file, size, start, end, elapsed).

BatFunk's ffprobe functions and batchlog example (warning: slow)
BatFunk's ffprobe functions and batchlog example 2 (pipe-delimited batchlog)
    - Writes video information (requires ffprobe) into a log file.

Fix Portrait Videos (vertical videos)
    - Demonstrates the 'iif' function (like IF...THEN...ELSE statement). The generated batch file probes for video information (ffprobe), and then selects either Operation A or Operation B (ffmpeg). This is a personal recipe for processing tall videos (a cropped, wider, darker and blurred out version of the tall video will be used as background).

M3U Video Play List - Long Videos Only (duration greater than 1 hour)
M3U Video Play List - Short Videos Only (duration less than 1 hour)
    - Another demonstration of 'iif'. Batch file decides if video will be added to the play list.

* Irfanview, ffmpeg, ffprobe, ffplay, TeraCopy, and VLC are registered trademarks of their respective yada yada and all that...

Download AutoBatcherBatFunk:

AU3 Source Code Only Version:

Executable (Windows):

1 comment: