StainlessS
5th May 2023, 11:37
Mod to stuff posted elsewhere:- https://forum.doom9.org/showthread.php?p=1979916#post1979916
Added two batch files to encode 1:1 FAR avisynth result clips (pixels are 1:1 aspect ratio), to output MP4 and MKV,
perhaps mod for your particular needs.
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
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
Avoid problem (eg not frame accurate source filter) clips by converting to AVI with UtVideo video and PCM audio lossless codecs.
Convert_Input_To_UtVideo_Output.BAT
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
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
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/nhaxvwpcjphlkn8/BATCH_CONVERTER.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,
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.
Reino 32 bit XP [Included in zip, works anywhere but maybe slower in x64 machine] compatible ffmpeg:- https://rwijnsma.home.xs4all.nl/files/ffmpeg/?C=M
I suggest STATIC linked [no dll's] version.
Perhaps users would like to post their additional favourite compatible FFMPEG BAT files. [Together with a name for the BAT file]
Added two batch files to encode 1:1 FAR avisynth result clips (pixels are 1:1 aspect ratio), to output MP4 and MKV,
perhaps mod for your particular needs.
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
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
Avoid problem (eg not frame accurate source filter) clips by converting to AVI with UtVideo video and PCM audio lossless codecs.
Convert_Input_To_UtVideo_Output.BAT
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
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
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/nhaxvwpcjphlkn8/BATCH_CONVERTER.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,
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.
Reino 32 bit XP [Included in zip, works anywhere but maybe slower in x64 machine] compatible ffmpeg:- https://rwijnsma.home.xs4all.nl/files/ffmpeg/?C=M
I suggest STATIC linked [no dll's] version.
Perhaps users would like to post their additional favourite compatible FFMPEG BAT files. [Together with a name for the BAT file]