0

About 2 years ago I created a batch script to scan video files with mediainfo, return a value, compare the value to a set value/integer, and then run handbrake if the comparison passed. Else, skip the file.

I would like to make the script more customizable by adding a GUI. All this GUI would have to do is the following things:

  • Set in & out folder paths.
  • Drop down menu to select mediainfo parameter.
  • Drop down menu to set comparison operator.
  • Text box to set value/integer to be compared to mediainfo returned value.
  • Text box to set custom encoding settings for handbrake.
  • Lastly, perhaps a cmd viewer to watch the script run through files and encode them.

Here's the entire batch script file:

@echo off
set mediainfo="%~dp0MediaInfo.exe"
set result="%~dp0bitrate.txt"
set handbrake="%~dp0HandBrakeCLI.exe"
SETLOCAL ENABLEDELAYEDEXPANSION
Set /P a=Enter source path:
set a1=%a: =_%
set src=%a1:"=%
if not %src:~-1%==\ set src=%src%\
Set /P b=Enter destination for converted files:
set b1=%b: =_%
set dest=%b1:"=%
if not %dest:~-1%==\ set dest=%dest%\
for /R %a% %%j in (*.*) do (
    Echo Filepath is: %%j
    %mediainfo% --Inform=General;%%BitRate%% "%%j" > %result%
    set /P bitrate=<%result%
    del %result%
    echo Bit Rate is: !bitrate!
    if !bitrate! gtr 4500000 (
    set fpath=%%~dpj
    set fpath=!fpath: =_!
    set trg=!fpath:%src%=%dest%!
    if not !trg:~-1!==\ (set trg="!trg:_= !\") else (set trg="!trg:_= !")
    set fnl="!trg:"=!%%~nj.mkv"
    if not exist !trg! mkdir !trg!
    %handbrake% -i "%%j" -o !fnl! -f mkv -e x264 -q 20 --vfr -a 1,1 -E av_aac,ac3 -B 192 -x level=4.1:vbv-bufsize=7000:vbv-maxrate=4500) else (echo No need to transcode.)
)
cmd /k

So my question is, how would I go about making a GUI that can easily pass variables to the batch file. I was looking into HTA, but that seems mostly VBscript/javascript based, not sure if it works well with batch. Also, I recently came across AutoIt but not sure if it'll do what I need.

Just looking to be pointed in the right direction. Thanks. github.com/j0ckinjz/Batch-Convert-Script

Edit:formatting

Jason
  • 21
  • 2
  • Yes, you could use HTA, VBscript or Jscript or even powershell to get responses from the user. – Squashman Dec 01 '17 at 19:28
  • 2
    Possible duplicate of [Windows Batch file launch a gui with buttons](https://stackoverflow.com/questions/34867023/windows-batch-file-launch-a-gui-with-buttons) – zett42 Dec 01 '17 at 23:53

0 Answers0