Windows Batch Script to Encode Video

So this is the project I am posting in response to @Atomic_Charge 's challenge.

Update: Project also posted at https://tekwiki.beylix.co.uk/index.php/Windows_Guides by @sarhatabaot
Also: if you're using this please let me know by commenting, especially if you have any feedback.

Project description (from github):

vEncode.bat is a windows script that encodes video to h264/h265.

aEncode.bat, a companion script, supports audio-only encoding.

Key Features:

  • Makes batch video processing very easy
  • AviSynth/Scripting friendly
  • H264/H265/Opus support
  • Supports changing key encode options crf/resolution/preset/bit-depth/chroma
  • Easily change the default encode settings and/or change them at runtime dynamically
  • Supports using the latest versions of key tools (ffmpeg, x264, x265, mkvmerge)
  • Automatically place encoded video into Matroska (mkv) or standard MPEG (mp4) containers

Example Usage:

vEncode Syntax:
vEncode myfile.mp4 {h264/h265} {resolution} {crf} {audio codec} {preset} {bit-depth} {chroma}
Note1: order is important
Note2: {} means optional
Note3: Double quotes "" means "use the default value"

Examples:
vEncode myfile.mkv
vEncode "my file.mkv" h265
vEncode file.mkv h264
vEncode file.mkv "" 720p
vEncode file.mkv "" 720p 20
vEncode file.mkv h264 1080p 20
vEncode file.mkv h265 1080p 20 opus
vEncode file.mkv h265 480p 20 opus veryslow
vEncode file.mkv h265 "" 18 opus veryslow
vEncode file.mkv h265 720p 18 opus veryslow 10
vEncode file.mkv h265 "" "" opus "" "" 420

To encode all video files in a directory:
vEncode * h264 "" 16 none veryslow 8 420
vEncode * h265 "" 17 copy "" 12 420
vEncode * h265 720p 17 opus veryslow 10 444
vEncode *

Reasons to use this over Handbrake:

  • CLI
  • Easier to do batch video processing
  • 8,10 and 12 bit support (handbrake only does 8-bit)
  • use the latest versions of all executables
  • additional chroma options
  • opus support

Reasons to use Handbrake over this:

  • GUI (if you're into that, eww)
  • supports hardsubbing

Download From:

https://github.com/gdiaz384/vEncode/releases (~200mb)

Technically it's like 11:59pm (in my timezone) so I still finished on time by the end of April 4th so yes I'm a chronic procrastinator.

5 Likes

Looks useful, thanks for posting 😊

1 Like

If you don't feel lazy then you should add this to the /wiki/ :P

I am glad that we have another GUI disliker on our hands :)

1 Like

I have gone ahead and put this into the wiki.

ty~

Rock on, should be able to overcome the hardsubbing issue with this, I'm sure I've done this in the past with AviSynth but needed VSFilter IIRC, like:

TextSub("C:\Path\To\Movie.srt")

Actually, it makes more sense (if I was going to add hardsubbing as a feature) to use ffmpeg's subtitle render but I look down upon .srt/sup/vob subs (no features) and hardsubbing (damages the video, eww).

The Advanced SubStation Alpha format (.ass) and soft-subbing approach has too many advantages and vEncode/aEncode will already soft-embed any subtitle files (all formats) if the source had them.

Furthermore, if an AviSynth script gets used to load the subs and embed them (srt/ass or otherwise), then that will occur prior to initializing vEncode so the hardsubbing process would be transparent.

from doing subtitling work for a living the advantage of hard subtitles is that there are players and languages that do not show soft subtitles or can not be played in some regions with out the installation of language packs. for instance STL subtitles can not do certain chinese dialects without transitioning from a text file to a linked set of PNG overlays which a fair number of software players will not use.

Agreed on both counts, my preference is for soft subs, by a long shot, but you can't account for target playback devices or others preferences for equipment/software so sometimes you just have eww up and hard sub.

It wasn't a statement of preference though, it was just an "it's possible in this manner" reply.