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):

Saturday, January 7, 2017

YTDL_Batch - A batch youtube downloader program

YTDL_Batch is a modest Windows front-end written in AutoIt for an awesome CLI program called youtube-dl. Although youtube-dl, in and by itself, does a great job of batch downloading online videos (check out the overwhelming list of supported sites), I feel, however, the need to write a simple front-end to be able to use youtube-dl easily.

The real chore is gathering the URLs or links of the videos you want to download. I wrote "ClipLog.exe" specifically for this task. It monitors the clipboard, copies and appends all URLs/links to a text file (ClipLog.txt). You will be amazed by how many links of interesting video thumbnails you could acquire in an hour. All you have to do is copy and copy without ever pasting which literally cuts the work in half.

Now that "ClipLog.txt" is full of video URLs, you then proceed by dropping this file onto the file "YTDL_Batch_[DropClipLogHere].exe". A batch file and a corresponding log will be generated and you're done! I really like the workflow that I defined, and I think that you will like it too.

1. Removes duplicate URLs.
2. Youtube-dl supports downloading whole playlists.
3. YTDL_Batch can resume an interrupted batch file and youtube-dl can resume an interrupted download.
4. YTDL_Batch displays the current download on the title (e.g. 35/284) and logs the time it started and ended.
5. Each generated batchfile downloads to its own corresponding sub-folder.

Download YTDL_Batch HERE.

youtube-dl's supported sites

P.S. Expect AutoIt's UPX false positive on your AV.