Thread: VirtualDub2
View Single Post
Old 19th December 2022, 01:31   #1149  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
OK GAP, posted script was not quite right but worked for me [I aint no command line expert, in fact I hate it ]

This seems to be quite bullet proof, and seems to cope OK with SPACES and even Japanese/Chinese hieroglyphics in the file names.
(which earlier scripts did not do well with)


Folder structure
Code:
BATCH_CONVERTER\                            # Containing directory, move it anywhere.
    FFMPEG\                                 # Directory Contains FFMPEG.EXE # EDIT: Plus any required ffmpeg dll's if ffmpeg.exe is not statically linked version, ie requires some ffmpeg dll files.
    INPUT\                                  # Dir, files to be converted
    OUTPUT\                                 # Dir, Converted results
    Convert_Input_To_UtVideo_Output.BAT                 # Batch File, convert to lossless AVI
    Encode_SquarePixel_AVS_Input_To_Output_AVC_MP4.BAT  # Batch File, Encode square pixel AVS script to x264 MP4
    Encode_SquarePixel_AVS_Input_To_Output_HEVC_MKV.BAT # Batch File, Encode square pixel AVS script to x265 MKV

Convert_Input_To_UtVideo_Output.BAT
Code:
setlocal

REM Where to Find ffmpeg
set FFMPEG=".\FFMPEG\ffmpeg.exe"

FOR /R ".\INPUT" %%A IN (*.wmv *.mpg *.avi *.flv *.mov *.mp4 *.m4v *.RAM *.RM *.mkv *.TS *.ogv *.264 *.webm *.m2v *.VOB) DO (
  %FFMPEG% -i "%%A" -vcodec utvideo -acodec pcm_s16le ".\OUTPUT\%%~nA.AVI"
)
Pause
These two set aspect ratio based upon square pixels, ie by input AVS FAR, Frame Aspect Ratio (ie width/height).
Maybe mod to your favourite crf and aac audio bitrate.
Encode_SquarePixel_AVS_Input_To_Output_AVC_MP4.BAT
Code:
setlocal

REM Where to Find ffmpeg
set FFMPEG=".\FFMPEG\ffmpeg.exe"

FOR /R ".\INPUT" %%A IN (*.avs) DO (
  %FFMPEG% -i "%%A" -c:v libx264 -crf 21.5 -preset slow -c:a aac -b:a 96k  ".\OUTPUT\%%~nA.MP4"
)
Pause
Encode_SquarePixel_AVS_Input_To_Output_HEVC_MKV.BAT
Code:
setlocal

REM Where to Find ffmpeg
set FFMPEG=".\FFMPEG\ffmpeg.exe"

FOR /R ".\INPUT" %%A IN (*.avs) DO (
  %FFMPEG% -i "%%A" -c:v libx265 -crf 25.0 -preset slow -c:a aac -b:a 96k  ".\OUTPUT\%%~nA.MKV"
)
Pause
Can create your own as above, or download 7z compressed file of about 35MB [including ffmpeg.exe] from UTILITY/Batch_Converter.7z
from StainlessS@MediaFire below this post in my sig. [in the UTILITY folder]

or direct link here:- https://www.mediafire.com/file/nhaxv...VERTER.7z/file

I think you could point output to anywhere else by replacing BLUE '.\OUTPUT' above with FULL DRIVE & PATH (no filename nor extension EDIT: Output folder MUST Exist)

If you already have path to ffmpeg.exe set in your system environment PATH Variable, then can change above %FFMPEG% to just FFMPEG.EXE and it should work without needing
the FFMPEG\ffmpeg.exe in zip.
eg,
Code:
setlocal

FOR /R ".\INPUT" %%A IN (*.wmv *.mpg *.avi *.flv *.mov *.mp4 *.m4v *.RAM *.RM *.mkv *.TS *.ogv *.264 *.webm *.m2v *.VOB) DO (
  Ffmpeg.Exe -i "%%A" -vcodec utvideo -acodec pcm_s16le ".\OUTPUT\%%~nA.AVI"
)
Pause
and then dont need the FFMPEG folder or zip included ffmpeg.exe.

EDIT: Reino 32 bit XP [works anywhere] compatible ffmpeg:- https://rwijnsma.home.xs4all.nl/files/ffmpeg/?C=M
I suggest STATIC linked [no dll's] version.

EDIT: Any further updates will be posted HERE:- https://forum.doom9.org/showthread.php?p=1986671
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 5th May 2023 at 11:40.
StainlessS is offline   Reply With Quote